GetPIDByName

Demonstrates how to return the process ID of a named process.

Remarks

This example illustrates how to get the PID of FLY!, wait for a few seconds and then terminate the process.

The GetPID() intrinsic returns -1 if it fails, the process id otherwise.

Code

 local int PID, int PID2, int Success

 PID = RunTask("fly", "", "", Null)

 call Sleep(3)

 PID2 = GetPIDByName( "fly" )

 Print "PID = ", PID
 Print "PID2 = ", PID2

 Success = KillTask( PID )

 Print "Task killed? ", Success

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.