System.EnumerateProcesses

table System.EnumerateProcesses ( 

 )

Example 1

open_processes = System.EnumerateProcesses();

Gets the process IDs and executable file paths for every process that is currently running and stores them in a table named open_processes.

Example 2

instances_of_file = 0;
file_to_check_for = "dummy.exe"; --have all lowercase
processes = System.EnumerateProcesses();

for j, file_path in pairs(processes) do
    file = String.SplitPath(file_path);
    if (String.Lower(file.Filename..file.Extension)) == file_to_check_for then
        System.TerminateProcess(j);
    end
end

Terminates all processes that were spawned by the executable "dummy.exe."

See also:  Related Actions