2017-08-24 112 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 
相关问题