If someone want to try :
If $CmdLine[0] == 0 Then Exit
$path = "E:\mGalaxy Emulators\PS2\PCSX2 1.0.0\"
$app = "pcsx2-r5350.exe"
HotKeySet("{ESC}", "Terminate")
$PID = Run( $path & $app & ' ' & $CmdLineRaw , $path)
while _WinWaitActivePID($PID)
sleep(500)
wend
While 1
Sleep(500)
WEnd
exit 0
Func Terminate()
While ProcessExists ( $PID )
ProcessClose ( $PID )
WEnd
Exit 0
EndFunc
Func _WinWaitActivePID($iPid)
While 1
Local $list = WinList()
For $i = 1 To $list[0][0]
If $list[$i][0] <> "" And IsVisible($list[$i][1]) Then
If WinGetProcess($list[$i][1]) = $iPid AND WinActive($list[$i][1]) Then Return $list[$i][0]
EndIf
Next
WEnd
EndFunc
Func IsVisible($handle)
If BitAND(WinGetState($handle), 2) Then
Return 1
Else
Return 0
EndIf
EndFunc
Work with
<Cmd id="0" name="ePSXe AutoIT" value="--fullscreen --nogui "%path\%file%ext"" />
In fact no danger with this code.
while _WinWaitActivePID($PID)
sleep(500)
wend
This part just wait for the application is active and visible (it don't put it on top, no action on emulator windows). If you don't have the bug, no problem with it.
Personnaly, I never use relative path for lot of reasons
1 - All my emulator are portable, I can just copy a folder to play it everywhere on simple usb key.
2 - The path aren't the same on all my computers and only 1 computer can compile autoit script.
3 - Sometime, I modify path name, when I clean up my computer or if the emulator change its version.
4 - Friends can take my files and play them directly, without modifications or rebuilding autoit script. And, of course, they haven't my windows configurations files.
5 - When I make emulation tries, I create a copy folder to don't modify the working folder. I just need copy/rename and it s finished with a delete.
And it's for that I m dreaming of a mGalaxy portable version ^^.