Process Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Process Operations >

Process Commands

KPN. - Kill Process by Name

Previous Top Next


MiniRobotLanguage (MRL)

 

KPN. Command

Kill Process by Name

 

 

Intention

 

This command is used to kill all processes with a specified name. For example, if you want to kill the "Internet Explorer" you could use:

 

' will close one IE

KPN.iexplore.exe

 

' Will close all IE's

KPN.iexplore.exe|a

 

Here is an complete working example.

 

KPN.iexplore.exe|a

WII.5000

FOR.$$CNT|1|20

 EXS.iexplore|www.fa2.de

NEX.

MBX.Click Me to Close all IE's

' Here we do NOT use background Mode

KPN.iexplore.exe|a

PAU.5

ENR.

 

KPN. has a background mode. In this Mode, the script will continue running while KPN. will close these processes in the background, while your script continues.. In short it looks like this.

 

KPN.iexplore.exe|ab

' Give it a bit time to work in the background

PAU.4

 

A complete working example looks like this:

 

KPN.iexplore.exe|a

WII.5000

FOR.$$CNT|1|20

 EXS.iexplore|www.fa2.de

NEX.

MBX.Click Me to Close all IE's

' Here we use background Mode

KPN.iexplore.exe|ab

PAU.5

ENR.

 

 

You can also specify PID's that will be ignored (not closed). This would look like this:

 

KPN.iexplore.exe|ax=123,$$PID,2134

KPN.iexplore.exe|abx=123,345,$$PID

 

 

 

Syntax

 

 

KPN.P1[|P2]

 

 

Parameter Explanation

 

P1 - Processname:

 name or part of a name or path of a process.

 You can use the standard search patterns.

 You can give a full path or just the process name or a part of it.

 

P2 - Options:

 Generally the first process fitting that name will be ended.

 If you have more processes with the same name and you want to end

 them all, use the

      a - Flag: End All processes fitting that name

 

 You can add exceptions which will NOT be killed using the

    x= option.

 For this, just give all the PID's (Process ID's) of the processes

 that should not be killed.

 

 You can use the GDF. - command to get a PID from a window.

 

Important Notice: If you use KPN. at the end of your script, you may need to add a PAU. - command because KPN. works in the background!

If the script ends, the KPN.-background process would also end before its finished.

 

See this example:

 

KPN.iexplore.exe|a

CAW.ieframe

WII.5000

FOR.$$CNT|1|20

 EXS.iexplore|www.fa2.de

 STS.DUMP

 PAU..1

NEX.

STS.DUMP

MBX.Click to CLose all IE's

KPN.iexplore.exe|a

ENR.

 

 

Example

 

'***********************************************

' KPN. Examples

'***********************************************

' close all Internet explorers

KPN.iexplore.exe|a

 

STW.c|ieframe

GDF.hp|$$PID

 

' close all Internet explorers except the one we localized above

KPN.iexplore.exe|ax=$$PID

 

 

'***********************************************

 

 

 

Remarks

 

Prefer CLW. and CAW. before using KPN. While KPN. is faster, its also more violent.

CLW. is less violent to the process and makes sure that all process resources are properly freed. KPN. is similar then if you "shoot a process" using the windows task manager. If you can't shoot a process using the windows task manager, KPN. may also fail.

 

 

Limitations:

 

-

 

 

See also:

 

  CLW. - Close-Window

  CAW. - Close-All-Windows

  CPR. - Close-PRocess

  KPN. - Kill Process by Name

    IEP. / NEP. - If-Exists-Process

    GDF. - Get-Data-From

    GPI. - Get Process Information

    GPU. - Get Process User

    WPR. - Wait-Process-Running

    WPT. - Wait-Process-Termination