BBjThinClient::clientExec

Description

This method executes a command on the client machine.

Syntax

Return Value

Method

int

clientExec(BBjVector commandLine!)

int

clientExec(BBjVector commandLine!, string workingDir)

int

clientExec(string commandString)

int

clientExec(string commandString, string workingDir)

Parameters

Variable

Description

commandLine!

In BBj 14.0 and higher, specifies the command and arguments as individual string elements of a BBjVector.

workingDir

In BBj 8.0 and higher,, specifies the directory in which to execute the command.

commandString

Specifies a command line to be executed on the client machine.

Return Value

Returns the process return code from the operating system.

Remarks

The BBjVector version of this method prevents the operating system shell from interpreting special characters in the command or arguments. Each argument will be passed verbatim to the command. If an argument contains quotes, these quotes will be passed to the OS-specific call and will not be further processed by BBj.

This method is equivalent to invoking SCALL(), except BBj will ignore SETOPTS bit 8, $08$ and always execute the command on the client. It does not inherit the environment of the ThinClient.

Note: If you do not pass the workingDir parameter, you should not make any assumptions about the client's current working directory. Specify the workingDir parameter, specify the fully-qualified path to the executable, or ensure the client environment's PATH variable includes the directory of the executable.

BBj supports two types of client executions: synchronous and asynchronous. In a synchronous client execution, the interpreter waits until the command is completed to resume operation. This is the default operation. In an asynchronous execution, the interpreter does not wait for the command to complete before resuming operation. To invoke a client command asynchronously, insert an ampersand (&) as the last character in the command line.

The BUI client does not support this method; it reports !ERROR=151  (Unsupported operation).  See BUI: Interacting with client files for a detailed discussion of the BUI BBjThinClient.

Example

rem ' BBjThinClient::clientExec

 

tc! = bbjapi().getThinClient()

 

REM Run notepad on the client's machine

tc!.clientExec("notepad.exe")

 

REM Open a file in a directory with spaces asynchronously

args! = bbjapi().makeVector()

args!.addItem("notepad.exe")

args!.addItem("C:\Program Files\notes.txt")

args!.addItem("&")

tc!.clientExec(args!)

See Also

BBjAPI

BBjThinClient

BBjInterpreterServer

BBjInterpreterServer::serverExec

SETOPTS

SCALL

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.



______________________________________________________________________________________

Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.