Function Reference


ProcessList

Returns an array listing the currently running processes (names and PIDs).

ProcessList ( ["name"] )

Parameters

name [optional] If a name is given only processes of the same name will be returned.

Return Value

Success: An array of process names and PIDs (See Remarks).
Failure: @error is set to 1 when the array cannot be built.

Remarks

The array returned is two-dimensional and is made up as follows:
$array[0][0] = Number of processes
$array[1][0] = 1st Process name
$array[1][1] = 1st Process ID (PID)
$array[2][0] = 2nd Process name
$array[2][1] = 2nd Process ID (PID)
...
$array[n][0] = nth Process name
$array[n][1] = nth Process ID (PID)

The list can be empty if $array[0][0] = 0. No @error set in this case.

Related

ProcessClose, ProcessExists, ProcessSetPriority, ProcessWait, ProcessWaitClose, ProcessGetStats, WinGetProcess

Example


; List all processes
Local $list = ProcessList()
For $i = 1 To $list[0][0]
    MsgBox(0, $list[$i][0], $list[$i][1])
Next

; List just notepad.exe processes
$list = ProcessList("notepad.exe")
For $i = 1 To $list[0][0]
    MsgBox(0, $list[$i][0], $list[$i][1])
Next