ProcessWaitClose()

Auto Hotkey

ProcessWaitClose

Waits for ALL matching processes to close.

OutputVar := ProcessWaitClose(PID-or-Name , Seconds)
Command  Example: ProcessWaitClose "AutoHotkey.exe", 3.5
Function Example: PID := ProcessWaitClose("AutoHotkey.exe", 3.5)
OutputVar

The name of the variable in which to store the PID of the first matching process that still exists (if Seconds parameter is used) or 0 if all matching processes are closed.

PID-or-Name

This parameter can be either a number (the PID) or a process name as described below. It can also be left blank to get PID of the script itself.

PID: The Process ID, which is a number that uniquely identifies one specific process (this number is valid only during the lifetime of that process). The PID of a newly launched process can be determined via the Run command. Similarly, the PID of a window can be determined with WinGet.

Name: The name of a process is usually the same as its executable (without path), e.g. notepad.exe or winword.exe. Since a name might match multiple running processes, only the first process will be reported. The name is not case sensitive.

Seconds (optional)

Seconds to wait (can contain a decimal point). If Seconds is omitted, the command will wait indefinitely.

Related

ProcessClose, ProcessSetPriority, ProcessWait , ProcessExist, Run, WinGet, WinClose, WinKill, WinWait, WinWaitClose, WinExist

Examples

ProcessWaitClose, PID, AutoHotkey.exe