0

我已经尝试了一些变体,但没有运气:

Process, Exist, Game.exe
    Process, Close, GamePatcher.exe
Return

我正在玩一个游戏,即使在游戏启动后,启动器/修补程序也保持打开状态。

有任何想法吗?

4

1 回答 1

2

A While loop should help you out. Here is a solution using a little ProcExists function that can be reused.

Loop
{
    If ProcExists("Game.exe") and ProcExists("GamePatcher.exe") 
        break
    Sleep 500
}
; Both procs exist, wait for Game to close.
While ProcExists("Game.exe")
    Sleep 500
Process, Close, GamePatcher.exe
Reload ; Reloads waiting for both to exist again

ProcExists(p)
{    
    Process, Exist, % p
    Return ErrorLevel
}

If you want this to perform continuously (keep the script running at all times), it would be best to implement SetTimer like this:

#Persistent

SetTimer, checkGame, 1000
Return

CheckGame:
If ! ProcExists("Game.exe")
    Process, Close, GamePatcher.exe

ProcExists(p)
{    
    Process, Exist, % p
    Return ErrorLevel
}
于 2013-11-05T20:21:35.203 回答