How to Pass Parameters using the Launch File action

The Launch File action allows you to open a separate program (i.e. an EXE file, such as MS Word) or a new Opus publication. This action also allows you to pass information as you launch the file using what are called parameters. For example, you could launch a word processing program and specify which document you want to open. When you launch a new Opus publication from your current publication you can pass information to it so that the new publication behaves differently, depending on what information you pass – see Passing Parameters – Introduction for more information.

This section describes how to pass parameters to the new publication in Opus. This section does not describe all of the options available in the Launch File action; only those related to passing parameters, for a full description see Launch File action for more information.

How to Pass Parameters:

  1. Select the object on the page that will use the Launch File action. Open its Actions dialog and add the trigger and the Launch File action to it.

  2. In Launch this file option, enter the name of the new publication you want to launch.

  3. Use the with option/parameter option to add the parameters that will be passed to the new publication.

Note:
When passing parameters you MUST prefix a forward slash (i.e. /) to the parameter. For example the parameter Page2 would be entered like this /Page2.

  1. You can enter more than one parameter in the with option/parameter box. Each parameter must be separated by a space and prefixed with the forward slash, for example:

/Page2 /On /<Music>

In this example, three parameters have been entered: Page2, On and <Music>.

A parameter can either be text, a string or the name of a variable surrounded by chevrons (i.e. < >), for example:

/Page2 /"Background One" /<Music>

The first parameter is text – text must not contain spaces, you can use the underscore character (i.e. _) or capitalisation to make the text more readable.

The second parameter is a string – this is text surrounded by single or double quote-marks (e.g. ‘ ‘), strings can contain spaces.

The third parameter is a variable – the contents of the variable is the information passed and NOT the name of the variable.

  1. When launching another Opus publication the parameter is the information you want to send to your new publication. Each parameter is stored in a separate Opus variable called COMMAND_PARAM_ followed by a number which indicates which parameter it is. Using the example in point 5 above, three System variables will be created containing the following:

COMMAND_PARAM_1 will contain Page2

COMMAND_PARAM_2 will contain Background One

COMMAND_PARAM_3 will contain On

Notice that each parameter is given its own numbered COMMAND_PARAM variable – these variables are numbered 1 for the first parameter, 2 for the second parameter, and so on. Also notice that the forward slash is removed when the parameter is stored in the COMMAND_PARAM variable. Quote-marks are removed from string parameters. The contents of a variable parameter are stored in the COMMAND_PARAM variable, for example, the variable Music contained the value On.

  1. Using variables as a parameter means that the information can change as the publication is run by the user, which offers even greater flexibility when passing parameters.

  2. The COMMAND_PARAM variables are used by the new publication you open with the Launch File action.

Example 1: A Menu system

  1. A good example of why you would want to pass parameters is to create a menu in one publication that launches another publication on different pages depending on which menu option was selected.

  2. In the menu publication, create your menu options and add a Launch File action to each menu option.

  3. Create a variable in the menu publication that stores the page name to open in the new publication. For example, call the variable PageName.

  4. For each menu option add a Set Variable action before the Launch File action. Use the Set Variable action to set the PageName variable to the name of the page to open in the new publication.

  5. In the Launch File action for each menu option, add the following parameter to the with option/parameter box:

/<PageName>

  1. See Example 1 in the How to use Parameters in the new publication to setup the new publication to use this information.

  2. Once you have set up the new publication, the following will happen when the menu publication is run. The user will select a menu option; this will trigger the Set Variable and Launch File actions for this menu option. The Set Variable action will change the value of the variable to the new page name you have entered in the action. The Launch File action will then open the new publication and pass the name of the page you want to open to the new publication. The new publication will then open at the requested page and NOT the first page in the publication.

Related Topics:

Passing Parameters to a Launch File

Using Parameters with Publication Start-up

the Launch File action