Omnis Technical Note TNWE0020 June 2008

Using the RemoteLaunch web component

For Omnis Studio 4.3.1
By Omnis Engineering

Note the RemoteLaunch component was released with Omnis Studio 4.3.1.

The RemoteLaunch object is a new Remote Form component (web component) that allows you to perform various actions from within a remote form, such as opening or printing a file. Specifically, the RemoteLaunch component was created to allow users to open and print PDF documents in Omnis Studio running under Linux, since this functionality was not available in Omnis Studio for Linux. The new component can be used to perform many other actions, which can be specified in the $...cmds property for each platform.

The RemoteLaunch component has the following properties:

$action - can be set to kRMLaunchNone (for no action) or kRMLaunchApp; the latter executes the first of the actions specified in the list of commands in $wincmds, $maccmds, or $unixcmds - if the first command in the list is successful, subsequent commands are ignored, otherwise if it is unsuccessful, the next one is tried, and so on

$appdata - the binary data

$appdatacomplen - if the binary data is compressed, this property must be set to the uncompressed binary length

$appdataextension - the extension for the application, e.g. PDF, TXT

$documentname - the document or file name

$wincmds, $maccmds, $unixcmds - List of commands for the Windows, Mac or Unix platform; Column 1 is the command or * for the default action; if the default action is specified, Column 2 is the action verb such as Open, Print, etc. (column 2 is optional for Windows and Mac, but is not available for Unix).

You can add a RemoteLaunch object to your remote form and set its properties using the notation. The following code specifies a PDF file to open, and sets the properties of the RemoteLaunch component.

; create vars iWinCmd (List), iPath & iAction (Chars), iAppData (Binary), iAppDataLen (Num Long Int)
Do iWinCmd.$define(iPath,iAction)
Calculate iPath as "*" ;; No Application specified...can also be empty
Calculate iAction as "open" ;; Open is the default action
Do iWinCmd.$add(iPath,iAction)
ReadBinFile (
   "C:\Program Files\TigerLogic\OS431\local\localib.pdf",iAppData)
; Uncompressed version
Calculate iAppDataLen as 0 ;; As this is zero it will be uncompressed data
; or the compressed Version
Calculate iAppDataLen as binlength(iAppData)
Calculate iAppData as compress(iAppData)

Having loaded the file and specified the action you can set the properties of RemoteLaunch. Note you can use the $maccmds or $unixcmds properties to specify platform specific actions.

; RML is the RemoteLaunch object
Calculate $cinst.$objs.RML.$appdataextension as "PDF"
Calculate $cinst.$objs.RML.$appdatacomplen as iAppDataLen
Calculate $cinst.$objs.RML.$appdata as iAppData
Calculate $cinst.$objs.RML.$wincmds as iWinCmd
; or Calculate $cinst.$objs.RML.$maccmds as iWinCmd ;; for Mac
; or Calculate $cinst.$objs.RML.$unixcmds as iWinCmd ;; for Unix
Calculate $cinst.$objs.RML.$action as kRMLaunchApp

The following code opens some text data in Notepad.

Do iWinCmd.$define(iPath,iAction)
Calculate iPath as "*"
Calculate iAction as "openî
Do iWinCmd.$add(iPath,iAction)
Calculate iAppData as "Hello this is a test"
Calculate iAppDataLen as binlength(iAppData)
Calculate iAppData as compress(iAppData)

Now open the data using the RemoteLaunch component.

Calculate $cinst.$objs.RML.$appdataextension as "TXT"
Calculate $cinst.$objs.RML.$appdatacomplen as iAppDataLen
Calculate $cinst.$objs.RML.$appdata as iAppData
Calculate $cinst.$objs.RML.$wincmds as iWinCmd
Calculate $cinst.$objs.RML.$action as kRMLaunchApp