Launch program

Command group Flag affected Reversible Execute on client Platform(s)
Operating system YES NO NO All

Syntax

Launch program program-name|program-name,document-name Returns return-value ([Do not quit Omnis])

Options

Do not quit Omnis This option is ignored on platforms other than macOS. When running on macOS, specify this option to prevent Omnis from closing after launching the program

Description

This command launches the specified program.

On Windows and Linux, this command behaves just like the command Start program normal, except that you can also wait for the output from the program (see below). The Do not quit Omnis option is ignored.

On Windows and Linux, you can run a command line program, and receive the output from the program via the Returns clause of the command. If a variable is specified in the Returns clause, Omnis Studio waits for the executable to terminate before continuing, and returns the output from the command in the variable.

On Windows, you can omit the program name, and supply just the document name prefixed by a comma. This will open the document in the application associated with its file extension.

The rest of this command description applies only to macOS. If you include a file name, the application is launched with the file name as a document. If the specified file name represents a document which the program cannot understand, it will be ignored. You must specify pathnames for the program and document, as shown in the example below.

You can reference either the application (with the .app suffix) or the executable in the bundle. For example, to launch iTunes you can specify either : 

/Applications/iTunes.app 
or 
/Applications/iTunes.app/Contents/macOS/iTunes 

The default action is to quit Omnis, but the Do not quit Omnis option lets you keep Omnis open. If you choose this option, Omnis will continue to run in the background, concurrently with the new program. A new program launched by Omnis will always be opened on top, even if Omnis is already in the background. The flag is set false if an error is detected, for example, if a program or file name cannot be found. When you execute Launch program, control passes from your application to the operating system and there is no automatic way of returning to Omnis.

Example

# Launch the specified program
Launch program c:\windows\notepad.exe
If flag false
  OK message (Icon,Sound bell{Couldn't find notepad.exe}
End If

Optionally, you can pass one or more parameters to the target process separated by commas. For example:

Calculate lMyScript as  "/Users/user_1/my_script.sh"
Launch program /System/Applications/Utilities/Terminal.app,[lMyScript] (Do not quit Omnis)