PhantomScript v1.7 Reference - Copyright © 2006 P1 Systems Incorporated. All Rights Reserved.

Prev | Next | Users Guide | PhantomScript Reference | P1 Systems


Process Control

WaitForProcessExit

Syntax

WaitForProcessExit ProcessID=<pid> [Timeout=<secs>]
WaitForProcessExit <pid>

Description

Wait for a program started using the Command statement to complete.

Parameters

ProcessID=<pid>

The process ID obtained from a Command statement.

Timeout=<secs>

Optional. The number of seconds to wait for the process to exit before continuing anyway. The TimedOut intrinisic variable can be used to determine whether the wait timed out or not.

Remarks

The second form of the command, with the unlabeled <pid> parameter, may be used if no timeout is required.

Example

Command "Notepad test.txt" Result=pid
WaitForProcessExit ProcessID=pid Timeout=60
If TimedOut Then
StopProcess pid
EndIf

The above statements start the Windows Notepad program on the specified file, wait 60 seconds for the program to exit and if it has not exited within 60 seconds, terminates the program.



Prev | Next | Users Guide | PhantomScript Reference | P1 Systems

PhantomScript v1.7 Reference - Copyright © 2006 P1 Systems Incorporated. All Rights Reserved.