OS Command (Magic xpa 2.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.
The properties of the OS Command are:
OS Command
Result
Wait
Show
Condition (Cnd)
Android and iOS
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:
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:
-
Evaluate ClientFileCopy(ServerFileToClient('C:\Magic\ReleaseNotes.pdf'),'/sdcard/tmpfile.pdf')
-
Invoke OS 'pdf:/sdcard/tmpfile.pdf' (where the Execute On property is set to Client)
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.
Invoke Operations
Invoke Properties