ProcessWait()

Auto Hotkey

ProcessWait

Waits for a matching processes to exist.

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

The name of the variable in which to store the PID of the found process or 0 if no matching process exists or the command timed out (when Seconds parameter is used).

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, ProcessExist , ProcessWaitClose, Run, WinGet, WinClose, WinKill, WinWait, WinWaitClose, WinExist

Examples

ProcessWait, PID, AutoHotkey.exe