RUN想由配置文件中读取
#NoTrayIconif ProcessExists( "DF5Serv.exe" ) then
Run("e:\share.bat",""@SW_HIDE)
else
sleep(200)
endif
现在我想在上面修改下RUN是由配置文件中读取,这样就可以在配置文件中修改可执行的程序了,而且我想执行多个程序,鄙人愚蠢,请高手指点下下面的哪里错了
#NoTrayIcon
$1=IniRead(@ScriptDir&"\config.ini","config","server","")
if $1 then
if ProcessExists("DF5Serv.exe") then
Run("$1",""@SW_HIDE)
else
sleep(200)
endif
else
msgbox(64,"提醒","配置文件出错,请检查","")
endif
[ 本帖最后由 chidanchu 于 2008-7-6 04:55 编辑 ] 我搞定了,只不过使用变量后为什么就不能能把BAT给隐藏运行了啊
#NoTrayIcon
dim $1
$1=IniRead(@ScriptDir&"config.ini","config","server","")
if $1 then
if ProcessExists("DF5Serv.exe") then
Run($1)
else
sleep(200)
endif
else
msgbox(64,"提醒","配置文件出错,请检查","")
endif
如直接run("e:pause.bat",""@SW_HIDE)为什么使用变量后就不能用run($1,""@SW_HIDE)
[ 本帖最后由 chidanchu 于 2008-7-6 01:02 编辑 ] #NoTrayIcon
$1=IniRead(@ScriptDir&"config.ini","config","server","")
$2=IniRead(@ScriptDir&"config.ini","config","server1","")
$3=IniRead(@ScriptDir&"config.ini","config","server2","")
Func _RunDOS( $sCommand )
Return RunWait( @ComSpec & " /C """ & $sCommand & """", "", @SW_HIDE )
EndFunc
_RunDOS($1)
_RunDOS($2)
_RunDOS($3)
现在已经达到隐藏运行多程序的目的了,只不过不知如何与上面的配合起来,做到检测到进程才运行 $softname1=IniRead("softset.ini","1","softname","")
$softname2=IniRead("softset.ini","2","softname","")
$softname3=IniRead("softset.ini","3","softname","")
$softPath1=IniRead("softset.ini","1","softpath","")
$softPath2=IniRead("softset.ini","2","softpath","")
$softPath3=IniRead("softset.ini","3","softpath","")
if $softPath1 <>"" then
RunWait(@ScriptDir & "\" & $softPath1)
EndIf
if $softPath2 <>"" then
RunWait(@ScriptDir & "\" & $softPath2)
EndIf
if $softPath3 <>"" then
RunWait(@ScriptDir & "\" & $softPath3)
EndIf
懒得修改了,复制个例子给你看看 配置文件举例:
softname="7z 压缩工具"
softpath="soft\7z.exe"
softname="BitComet 去广告版(BT下载工具)"
softpath="soft\BT.exe"
softname="迅雷 5.8 去广告版"
softpath="soft\thunder.exe" 已经解决拉
If ProcessExists("QQ.exe") <> 0 Then
$RUN = IniReadSection(@ScriptDir & "\RUN.INI", "RUNPATH")
If @error Then
MsgBox(0, "", "INI读取不成功")
Exit
Else
For $i = 1 To $RUN
$TRUN = IniRead(@ScriptDir & "\RUN.INI", "RUNPATH", $RUN[$i], "")
If $TRUN <> "" And FileExists($TRUN)<> 0 Then
Run($RUN[$i], "", @SW_HIDE)
EndIf
Sleep(1000);多个程序间的运行间隔
Next
EndIf
EndIf
如果路径为空,或者文件不存在则不运行
下面是INI文件格式
1=c:\1.bat
2=c:\2.bat
3=c:\3.bat
4=c:\4.exe 正好用到~学习学习 正好用到~学习学习 我也是正好用到,谢谢{:face (190):}
页:
[1]