-First trial (WaitClose)
Code: Select all
Process, WaitClose, firefox.exe, 120 ; Process, Cmd, PID-or-Name [, Param3] seconds
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
MsgBox %NewPID%
-Second trial (Exist)
Code: Select all
Process, Exist, firefox.exe ; Process, Cmd, PID-or-Name [, Param3] seconds
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
MsgBox %NewPID%
-Third trial (Exist+WaitClose)
Code: Select all
Process, Exist, firefox.exe ; Process, Cmd, PID-or-Name [, Param3] seconds
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
MsgBox %NewPID%
Process, WaitClose, %NewPID%, 120
if ErrorLevel ; The PID still exists.
MsgBox The process did not close within 120 seconds.
-Fourth trial (Exist+Close)
Code: Select all
Process, Exist, firefox.exe ; Process, Cmd, PID-or-Name [, Param3] seconds
NewPID = %ErrorLevel% ; Save the value immediately since ErrorLevel is often changed.
Process, Close, %NewPID%
Where is the problem ? Misunderstanding of help ? Error in coding ? Bug ?
I run Windows 10 and Autohotkey Version v1.1.19.02
I may perhaps, as in :
https://autohotkey.com/boards/viewtopic.php?f=5&t=6455
use
Code: Select all
GroupAdd MultiClose, ahk_class MozillaWindowClass
WinClose, ahk_group MultiClose