Salesforce

Invoke OS Command (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

Invoke OS Command (Magic xpa 3.x)

An Invoke OS Command is an interesting operation. It basically calls a command in the native operation system. If you are running on one machine, it's obvious. But in a Rich Client environment, what does it mean? In fact, you may want to execute an Operating system command on the client, or on the server.

It is up to you to specify which environment will handle the command.

Invoke Server

Here we have a simple OS command that shows the current directory, and redirects it to a temporary file. The question is: are we showing the directory on the server machine, or on the client machine? This is controlled by the programmer, who sets the Execute On property. Here, it is set to server. That makes this Invoke Command a server-side operation.

Invoke Client

Here we have the same operation, but the Execute On property is set to Client. This makes the operation client-side. The directory being displayed will be on the client machine, wherever that happens to be.

Uses for Invoke OS

You can use the Invoke OS operation for running any operating system event on the client or server. In the examples above, the same command was executed:

dir > C:\Temp\Dir.txt

But in one instance, the server directory will be listed, and in the other, the client directory will be listed.

Note that there are also Magic xpa functions for accessing the operating system, so directly executing operating system code with Invoke OS isn't commonly needed. For instance, if you want to access the value of an operating system environment variable, you can easily use the OSEnvGet() function.

OSEnvGet() will fetch the server environment variables. A separate version of this function, ClientOSEnvGet(), will fetch the client environment variables. Other pairs of functions allow you to access file information (FileInfo() and ClientFileInfo(), for instance).

Reference
Attachment 
Attachment