2017-08-24 170 views
1

我的腳本一直工作到while循環存在的地步。 ScummVM正確啓動。爲什麼ScummVM關閉後我的腳本不能執行?

但是,我希望腳本執行的操作是在檢測到scummvm.exe已關閉時繼續運行並執行命令。每當我關閉scummvm時,什麼都不會發生。

#NoTrayIcon 
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. 
; #Warn ; Enable warnings to assist with detecting common errors. 
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. 
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. 

RunWait, "..\sc55 scummvm.exe" 
Run, ".\scummvm.exe" "--no-console" "--config=.\scummvm.ini" "samnmax" 
Process, Exist, scummvm.exe ;wait until scummvm.exe is found before continuing 
ScummVM = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed. 
while ScummVM != 0 ;while scummvm is running i.e., error level is not equal to 0 
{} ;"do nothing" 
msgbox "scummvm has closed" ;action taken when scummvm is closed 
return 

回答

1

執行命令scummvm.exe退出

RunWait, "..\sc55 scummvm.exe" 
Run, ".\scummvm.exe" "--no-console" "--config=.\scummvm.ini" "samnmax" 
loop { 
    sleep 5000 ; 5 seconds 
    Process, Exist, scummvm.exe 
} until ErrorLevel == 0 
msgbox "scummvm has closed" 
return 
相關問題