ph_runsync1 PowerHome formula function
Description
Execute an application synchronously or asynchronously.
Syntax
ph_runsync1 ( path, currdir, async, wait )
Argument Description
path String. The full path and filename of the executable to run.
currdir String. The default directory for the program to be executed in.
async Integer. Determines whether the application will run asynchronously or synchronously. Use 0 for synchronous execution. Use 1 for asynchronous execution.
wait Long. The number of milliseconds to wait for the executable to complete if the async parameter is 0. Use - 1 to wait indefinately.
Return value
Long. If the async parameter is 1, then 0 will be returned immediately. If the async parameter is 0 and the application is still running when the wait parameter expires, then 259 will be returned signifying that the application is still running. If the application completes before the wait parameter expires, then the return value will be the exit code returned by the application.
Usage
Use this function to execute an application under the PowerHome users context either asynchronously or synchronously. If you need to execute an application using a different user context, use the ph_runasuser or ph_runasuser1 functions.
Examples
The following examples demonstrate typical syntax/usage for this function.
ph_runsync1("notepad.exe","",1,0)
The above example will execute the Windows notepad application and return control immediately back to PowerHome (run asynchronously).