Salesforce

OS Command (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

OS Command (Magic xpa 3.x)

You can execute an external program, a batch, or command file at the operating system level. Magic xpa suspends the execution of the current task. When the external program, batch, or command file has been completed, Magic xpa resumes the execution of the task at the next operation.

OS Command Properties

The properties of the OS Command are:

Platform Specific

Android, iOS and Windows 10 Mobile

You can run device capabilities, such as calling a phone number, sending an SMS, and opening a browser, by using the Invoke OS command with the URL of the required command. Note that the Invoke OS command should be defined with the Execute On property set to Client.

For example:

Refer also to: http://developer.apple.com/library/safari/#featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007891-SW1"

Note: When sending mail, there are some characters that are not allowed in the subject and body. On iOS for example, the ampersand (&) character should be replaced with %26 and on Android the following characters should be removed: #,%,&, :, and =.

You can also use the convention described above to call 3rd party applications, which can be accessed via the URL format. For example, you can use:

  • 'waze://?q=New York' to open the Waze GPS application and navigate to New York.

  • 'geo:59.915494,30.409456’ to open a navigation app, such as Google Maps or Waze, on the 59.915494 latitude and 30.409456 longitude.

iOS

Since version: 2.3

You can print a PDF using the AirPrint protocol. You do this by using the Invoke OS command with the command of Print:filename where filename is either:

  • A path to a local file (as received from the ServerFileToClient function)

  • A URL to a file on a Web server (such as 'http://1.1.1.1/myfile.pdf')

Android

Since version: 2.4

You can view a PDF using a third-party PDF viewer application. You do this by using the Invoke OS command with the command of pdf:filename where filename is a path to a local file that is stored on a public folder on the device, such as the /SDCARD folder.

For example, the following commands will copy the ReleaseNotes.pdf file from the C:\Magic\ folder on the server to the /SDCAD folder on the client and will open a PDF viewer to show this file:

  1. Evaluate ClientFileCopy(ServerFileToClient('C:\Magic\ReleaseNotes.pdf'),'/sdcard/tmpfile.pdf')

  2. Invoke OS 'pdf:/sdcard/tmpfile.pdf' (where the Execute On property is set to Client)

Since version: 3.0

You can print a PDF using the Google Cloud Print protocol. You do this by using the Invoke OS command with the command of Print:filename where filename is:

  • A path to a local file (as received from the ServerFileToClient function)

Example

Here is an example of writing the Invoke OS expression to use the md (make directory) DOS command.

The command that needs to be called is: 'cmd.exe /c md d:\a2'

cmd.exe - Executes the cmd.

/c - Executes the cmd from disk c in order to identify the operating system commands.

md - The command that you want to invoke.

d:\a2 - The arguments that the command needs - the path and the directory name.

Related Topics

Reference
Attachment 
Attachment