[已解决]au3配置文件写入读取
本帖最后由 mshuking 于 2014-12-11 14:29 编辑au3配置文件写入读取#NoTrayIcon
$RUN = IniReadSection(@ScriptDir & "\run.ini", "runpath")
If @error Then
IniWriteSection("run.ini","runpath","1",$var)
IniWriteSection("run.ini","runpath","2",$var)
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
EndIfIf @error Then
IniWriteSection("run.ini","runpath","1",$var)
IniWriteSection("run.ini","runpath","2",$var)
Exit这个应该怎写才是对的
下面是INI文件格式
1=1.exe参数 如:1=1.exe192.168.0.251 加了参数不运行,应该怎么修改?
2=c:\4.exe
3=x.bat
帮忙修改下。。。。 回复 1# mshuking #NoTrayIcon
Local $ini = @ScriptDir & '\run.ini'
$aSession = IniReadSection($ini, 'runpath')
If @error Then
Local $sEXE1 = '1.exe192.168.0.251'
Local $sEXE2 = 'c:\4.exe'
IniWrite($ini, 'runpath', '1', $sEXE1)
IniWrite($ini, 'runpath', '2', $sEXE2)
Exit
Else
For $i = 1 To $aSession
$sEXE = IniRead($ini, 'runpath', $aSession[$i], '')
If $sEXE <> '' And FileExists($sEXE) Then
Run($aSession[$i], '', @SW_HIDE)
EndIf
Sleep(1000);多个程序间的运行间隔
Next
EndIf 本帖最后由 mshuking 于 2014-11-30 16:24 编辑
回复 2# user3000
Local $sEXE1 = '1.exe192.168.0.251'
能不能写成变量在配置文件读取 可以直接运行
RUN 读取配置文件 运行带参数的程序 不运行 回复 3# mshuking
哦,那是判断的条件不对.
'1.exe192.168.0.251'这样的文件是不存在的,所以就不运行了.
要先截取文件路径再作文件存在的判断.For $i = 1 To $aSession
$sEXE = StringRegExpReplace($aSession[$i], '^(.+?\.\w{3,})\h?.*', '\1')
If Not @extended Then ContinueLoop
If Not FileExists($sEXE) Then ContinueLoop
Run($aSession[$i], '', @SW_HIDE)
Sleep(1000);多个程序间的运行间隔
Next
页:
[1]