主题:  斑竹你好!这个语句什么意思呀?

刘打下

职务:普通成员
等级:1
金币:0.0
发贴:31
注册:2002/10/13 11:49:14
#12002/10/27 13:07:56
if fileExists(IniFile)=0 then
open "TT.exe"
else
open “WW.exe”
end if

其中的fileExists(IniFile)=0 是什么意思呀,就以QUICKTIME为例子吧,这个fileExists怎么设置呀?
谢谢斑竹告诉我!



我是小马

职务:普通成员
等级:3
金币:17.0
发贴:794
注册:2000/11/13 14:56:59
#22002/10/27 13:28:04
fileexists()是一个函数,IniFile是其参数,这个函数的作用是检测IniFile是否存在,是则返回1。

如果只是检测Quicktime的话,可以使用quickTimeVersion()

if quickTimeVersion() < 3.0 then
open "tt.exe"
else
open "ww.exe"
end if

要检测用户机器中是否安装必要的软件,比较好的方法是读用户的注册表。由于在Director没有直接对注册表进行操作的指令,所以我们只能借助第三方插件buddyapi xtra。
下面我以acdsee和adobe公司的acrobat reader为例来说明:
读取注册表的函数,用buddy api 插件的baReadRegString( KeyName, valueName, Default, Branch )
这四个参数均为string类型,下面是它们的一些说明,这些你都可以在buddy api的帮助文件中查到!
KeyName is the name of the key.
valueName is the name of the value. Under 16 bit, this value is ignored.
Default is the string that is returned if the key/value doesn't exist.
Branch is the branch of the registry to use. Can be one of the following:
"HKEY_CLASSES_ROOT"
"HKEY_CURRENT_USER"
"HKEY_LOCAL_MACHINE"
"HKEY_USERS"
"HKEY_CURRENT_USER"
"HKEY_DYN_DATA"
比如我们要读取acdsee的安装路径,那么语句应该这么写:
baReadRegString("software\microsoft\windows\currentversion\apppaths\acdsee.exe","path","error", "HKEY_LOCAL_MACHINE" )
要读取acrobat reader的安装路径,可以这么写:
baReadRegString("software\microsoft\windows\currentversion\apppaths\AcroRd32.exe","path","error", "HKEY_LOCAL_MACHINE" )