Autohotkey 为什么';ScummVM关闭后我的脚本不会执行吗?

Autohotkey 为什么';ScummVM关闭后我的脚本不会执行吗?,autohotkey,Autohotkey,我的脚本工作到while循环存在的程度。SCUMVM正确启动 但是,我希望脚本在检测到scumvm.exe已关闭时继续运行并执行命令。每次我关闭scummvm,什么都没发生 #NoTrayIcon #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common err

我的脚本工作到while循环存在的程度。SCUMVM正确启动

但是,我希望脚本在检测到scumvm.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

在scumvm.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