【问题标题】:Why doesn't my script execute after ScummVM closes?为什么 ScummVM 关闭后我的脚本不执行?
【发布时间】:2017-09-07 08:10:20
【问题描述】:

我的脚本一直运行到 while 循环存在的地步。 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

【问题讨论】:

    标签: autohotkey


    【解决方案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
    

    【讨论】:

      猜你喜欢
      • 2013-09-13
      • 1970-01-01
      • 2011-11-15
      • 2014-12-06
      • 1970-01-01
      • 2013-07-08
      • 1970-01-01
      • 2011-01-03
      相关资源
      最近更新 更多