Check if Process Exists

Verb: ifProcess

Available from: <Standard>

Checks if a process is running according to the specified selector type.

The process consists of a running instance of a computer program.

Syntax

ifProcess --by(ProcessBy) --id(Numeric) [--useRegex(Boolean)] --name(String) --regexPattern(String) [--regexOptions(DisplayableRegexOptions)] [--sessionsearch(Nullable<ProcessSessionSearch>)] --sessionid(Numeric) (Boolean)=value

Inputs

Script Designer Required AcceptedTypes Description
--by Find By Required ProcessBy Selector type for finding application process:
  • Id
  • Name
  • --id Id Only whenFind By is Id Number Process Id.
    --useRegex Use Regular Expression Optional Boolean When enabled, performs name search with regular expression.
    --name Process Name Only whenUse Regular Expression is False Text Name of the process that should be verified.
    --regexPattern Regular Expression Only whenUse Regular Expression is True Text Regular expression used for process verification.
    You can use the Regular Expression Editor via the toolbar in the "Tools" menu or by clicking on the corresponding editor icon in the command interface.
    --regexOptions Options Optional DisplayableRegexOptions Options to filter the search for regular expression. You can select more than one of the following:
    • Compiled
    • Culture Invariant
    • ECMA Script
    • Explicit Capture
    • Ignore Case
    • Ignore Pattern Whitespace
    • Multiline
    • Right To Left
    • Singleline
    --sessionsearch Set Session Search Optional ProcessSessionSearch Session in which to search the process. The options are:
    • Id
    • Name
    --sessionid Session Id Only whenSet Session Search is SpecifiedSession Number Session id you want to fetch.
    --regex Use regular expression(Obsolete) Optional Boolean When enabled, allows the use of a "Regular Expression" to search for the process.
    This parameter is obsolete, the Use Regular Expression parameter should be used instead.
    --ignorecase Ignore case(Obsolete) Optional Boolean When enabled, specifies case-insensitive matching.
    This parameter is obsolete. To select regular expression options, use the Options instead.
    --dotmatchesnewline Dot matches new line(Obsolete) Optional Boolean When enabled, the dot (.) character matches every character, instead of every character except "\n".
    This parameter is obsolete. To select regular expression options, use the Options instead.
    --freespacing Ignore white space(Obsolete) Optional Boolean When enabled, eliminates blank spaces and breaks without adding a escape character.

    This parameter is obsolete. To select regular expression options, use the

    Options

    instead.

    --explicitcapture Explicit capture(Obsolete) Optional Boolean When enabled, specifies that the only valid captures are explicitly named or numbered groups of the form (? ).
    This parameter is obsolete. To select regular expression options, use the Options instead.
    --multiline Multiline(Obsolete) Optional Boolean When enabled, changes the meaning of ^ and $ so they match at the beginning and end, respectively, of any line, and not just the beginning and end of the entire string.
    This parameter is obsolete. To select regular expression options, use the Options instead.

    Outputs

    Script Designer AcceptedTypes Description
    value Result Boolean Returns "True" if it finds the process, or "False" if it does not.

    Example

    The command checks to see if the process named "notepad" is running.

    defVar --name processResult --type Boolean
    // Search for the process name of the current session only.
    ifProcess --by "Name" --name notepad --sessionsearch "CurrentSession" processResult=value
    // Displays in the console whether or not the process is started.
    logMessage --message "${processResult}" --type "Info"
    

    See Also