SpGetPidList

From EDM2
Jump to: navigation, search

Retrieves a list of the process id's of all processes which module file names (full qualified) match against the given substring.

Syntax: success = spGetPidList ( stem [ , filter ] )

Parameters:

stem – The variable stem into which the list get stored.
filter – Substring of the filename of those processes which should be found.

Prepend a backslash to full filenames to prevent those processes which filenames contain filter as suffix from being found, e.g. XFILE.EXE and E.EXE.

Returns:

True (1) – At least one process identifier has been returned
False (0) – No process identifier has been returned

Example Code: (part of example code of spFilename from

/* ps.cmd (spUtils Example Code) */
/* List all currently active processes with pid and module name, */
/* optionally a filter substring can be passed as argument. */

CALL RXFUNCADD 'spLoadFuncs','spUtils','spLoadFuncs'
CALL spLoadFuncs

CALL spGetPidList 'p',ARG(1)
DO i=1 to p.0
     SAY RIGHT(p.i,5,' ') || ' ' || spFilenameFromPid(p.i)
END