lostom 0 Posted September 26, 2011 (edited) Good evening, I made a script a few weeks ago to load a program, and today I wanted to make it load some variables from a .ini file. After I added everything, the file just loads, but the program doesn't open, while it did open when I didn't added the iniread, so something is wrong with that most likely. $loops = 0 $crashes = 0 $clicks = 0 While 1 ;read from the .ini file $var = ProcessExists(IniRead ( "%A_WorkingDir%/linuxwatcher.ini", "1", "executable", "error" )) $var2 = WinExists(IniRead ( "%A_WorkingDir%/linuxwatcher.ini", "1", "executable", "error" )) ;Default ;read from the .ini file $var5 = winexists (IniRead ( "%A_WorkingDir%/linuxwatcher.ini", "1", "executable", "error" )) ;Default $var6 = Processexists ("thisprocess.EXE") ;Taken from default.ini If $var = 0 Then Run(IniRead ( "%A_WorkingDir%/linuxwatcher.ini", "1", "path", "error" ), IniRead ( "%A_WorkingDir%/linuxwatcher.ini", "1", "workingdirectory", "error" )) WinWait("IW4 Console") EndIf If $var2 = 1 Then ProcessClose(IniRead ( "%A_WorkingDir%/linuxwatcher.ini", "1", "executable", "error" )) $crashes += 1 EndIf ;Taken from the error.au3 If $var5 = 1 Then ProcessClose("thisprocess.EXE") ProcessClose(IniRead ( "%A_WorkingDir%/linuxwatcher.ini", "server1", "executable", "error" )) $crashes += 1 EndIf If $var6 = 1 Then ProcessClose ("thisprocess.EXE") $crashes += 1 EndIf EndIf and the .ini file: [server1] executable=process.exe path=D:\project\process.exe +parameter1 + parameter 2 workingdirectory=D:\project\ I have been working on a solution for a few hours now, but I just can't find the error... Thanks in advance. edit: the title should be iniread instead of readini of course. Edited September 26, 2011 by lostom Share this post Link to post Share on other sites
eracross 0 Posted September 26, 2011 (edited) Try this.. expandcollapse popup$loops = 0 $crashes = 0 $clicks = 0 Global $IniProcess, $IniPath, $IniDir While 1 ;read from the .ini file $IniProcess = IniRead ( "%A_WorkingDir%/linuxwatcher.ini", "server1", "executable", "NotFound" ) $IniPath = IniRead ( "%A_WorkingDir%/linuxwatcher.ini", "server1", "path", "NotFound" ) $IniDir = IniRead ( "%A_WorkingDir%/linuxwatcher.ini", "server1", "workingdirectory", "NotFound" ) $var = ProcessExists($IniProcess) $var2 = WinExists($IniProcess) ;Default ;read from the .ini file $var5 = winexists ($IniProcess) ;Default $var6 = Processexists ("thisprocess.EXE") ;Taken from default.ini If $var = 0 Then Run($IniPath, $IniDir) WinWait("IW4 Console") EndIf If $var2 = 1 Then ProcessClose($IniProcess) $crashes += 1 EndIf ;Taken from the error.au3 If $var5 = 1 Then ProcessClose("thisprocess.EXE") ProcessClose($IniProcess) $crashes += 1 EndIf If $var6 = 1 Then ProcessClose ("thisprocess.EXE") $crashes += 1 EndIf EndIf Edited September 26, 2011 by eracross Share this post Link to post Share on other sites
lostom 0 Posted September 27, 2011 Thanks for the response, and I got it working now, although, I also had to change this: $IniProcess = IniRead ( "%A_WorkingDir%/linuxwatcher.ini", "server1", "executable", "NotFound" ) to $IniProcess = IniRead (@WorkingDir & "\linuxwatcher.ini", "server1", "executable", "NotFound" ) Share this post Link to post Share on other sites