Environment > Distributing IDL Applications > Creating a Runtime Distribution > Runtime Application Launch Scripts

# Runtime Application Launch Scripts

The `bin/make_rt` subdirectory of the IDL installation directory contains generic launch scripts for Windows, Macintosh, and Linux/Solaris applications. If you use the MAKE_RT procedure to create a runtime distribution, the appropriate launch scripts will be copied to your distribution and renamed to match your application. If you specify a value for the SAVEFILE keyword, the launch scripts are modified by MAKE_RT to launch the specified SAVEFILE application. If the SAVEFILE keyword is not specified, executing the launch script prompts the end-user to select a .sav file to restore and run.

This section describes the different launch scripts in more detail, and explains how to configure and use them. Note that while some of the steps described here are performed by the MAKE_RT procedure, you may still need to modify the scripts to achieve the desired behavior.

## Windows Launch Script

To use the application launcher, follow the steps outlined below.

Note: If you use the MAKE_RT procedure, the launch scripts are copied to your runtime distribution and renamed to match the Appname argument automatically. The `start_app_win.ini` file is modified to run your SAVE file or open a file-selection dialog, depending on the value of the SAVEFILE keyword.

### Copy and Rename the start_app_win.exe File

Copy the file

IDL_DIR\bin\make_rt\start_app_win.exe

(where `IDL_DIR` is your IDL installation directory) to the location of your runtime distribution. If you want, rename `start_app_win.exe` to reflect the name of your application. (Be sure to retain the `.exe` extension.) For example, if your application is named `HydroPlot`, you could rename the `start_app_win.exe` file to `hydroplot.exe`.

### Copy and Rename the start_app_win.ini File

When a user clicks on the executable file (`start_app_win.exe` or whatever you have renamed it), the executable searches for and reads an `.ini` file with the same base name as the executable. If you renamed `start_app_win.exe`, you will also need to rename the `.ini` file with the same base name. For example, if you renamed `start_app_win.exe` as `hydroplot.exe`, you would rename `start_app_win.ini` as `hydroplot.ini`.

Copy the file

IDL_DIR\bin\make_rt\start_app_win.ini

(where `IDL_DIR` is your IDL installation directory) to the location of your runtime distribution. Rename the `.ini` file to match the name of the executable file, if you have changed it from `start_app_win.exe`.

### Modify the start_app_win.ini File

The `.ini` file (`start_app_win.ini` or whatever you have renamed it) specifies what will happen when the user runs the `.exe` file. If you use the MAKE_RT procedure and specify a value for the SAVEFILE keyword, the `.ini` file is rewritten to launch your application. If you copy the `.ini` file manually, you must modify it as described below.

The `start_app_win.exe` file can either run a single application immediately or display a dialog with up to four buttons, each of which invokes a different application. The configuration of the dialog (including whether or not it is displayed at all) is controlled by the `.ini` file.

The `.ini` file contains five sections, one labeled `[DIALOG]` and four labelled `[BUTTONn]` (where n is a number between 1 and 4). The contents of each type of section are described below.

#### DIALOG Section

[DIALOG]

Show=False

BackColor=&H6B1F29

Caption=<any string>

Picture=.\splash.bmp

DefaultAction=<path to application>

- Show — this field can contain the string `True` or `False`. If `Show=True`, the dialog is displayed and the `DefaultAction` is not executed. If `Show=False`, the dialog is not displayed, and the `DefaultAction` is executed immediately when the user double-clicks on the `start_app_win.exe` icon.
- BackColor — this field contains an RGB color triplet specified in hexadecimal form. This color will be used in any part of the dialog that is not covered by the image specified as the value of the `Picture` field. To make the background white, set `BackColor=&HFFFFFF`.
- Caption — this field contains a string that will be displayed in the title bar of the dialog, if `Show=True`.
- Picture — this field contains the relative path to a Windows bitmap file that will be displayed in the dialog if `Show=True`. The image will be positioned with its upper left corner in the upper left corner of the dialog window. To completely fill the dialog, the image contained in the bitmap file should be 480 x 335 pixels. Any area of the dialog that is not filled by the image will be displayed in the color specified in the `BackColor` field.
- DefaultAction — this field contains the command that should be executed when `start_app_win.exe` is run if `Show=False`. In most cases, you will need to specify the relative path to the `idlrt.exe` file in the IDL distribution on your CD-ROM, followed by the `-vm` flag and the relative path to your application’s SAVE file.

  For example, if you have placed the SAVE file for the application `hydroplot.sav` in the `hydroplot` directory of the CD-ROM along with the `start_app_win.exe` application, the following `DefaultAction` launches `hydroplot.sav` in the IDL Virtual Machine when the user double clicks on the `start_app_win.exe` icon:

  DefaultAction=.\idl71\bin\bin.x86\idlrt.exe -vm=hydro\hydroplot.sav

  (The `DefaultAction` specification should be on a single line.)

#### BUTTON Sections

There can be up to four `[BUTTON]` sections. The format is the same for any section of this type.

Note: If the `Show` field of the `[DIALOG]` section is set to `False`, no buttons will be displayed, regardless of the content of the `[BUTTON]` sections.

[BUTTON1]

Show=True

Caption=<any string>

Action=<path to application>

- Show — this field can contain the string `True` or the string `False`. If `Show=True`, the button will be displayed on the dialog.
- Caption — this field contains a string that will be displayed on the button, if `Show=True`.
- Action — this field contains the command that should be executed when the user clicks on the button, if `Show=True`. See Default Action above for an explanation of the format of the command string.

  To create a button that closes the dialog without executing anything, set `Action=Exit` on the button.

### Copy and Modify the autorun.inf File

If you want your application to launch automatically when the user inserts your CD-ROM, you must modify the `autorun.inf` file. The `autorun.inf` file contains the following lines:

[autorun]

open = start_app_win.exe

icon = idl.ico

If you want your application to launch automatically when the user inserts the CD-ROM, copy the file

IDL_DIR\bin\make_rt\autorun.inf

(where `IDL_DIR` is your IDL installation directory) into your runtime distribution and modify the

open = start_app_win.exe

line to reflect the name of the executable file you want to launch automatically. For example, if you renamed `start_app_win.exe` to `hydroplot.exe`, change the line to read:

open = hydroplot.exe

If your executable file displays a dialog, you might want to modify the

icon = idl.ico

line to specify an icon that will be displayed in the Windows task bar. If you specify an icon file in your `autorun.inf` file, you must ensure that the icon file is included in the root directory of your CD-ROM.

## Macintosh Launch Script

The `bin/make_rt` subdirectory of the IDL installation directory includes two Applescripts that you can use to launch your application. To use the Applescripts, follow the steps outlined below.

Note: If you use the MAKE_RT procedure, the launch scripts are copied to your runtime distribution automatically. The `start_app_mac.app` file is renamed to match the Appname argument and modified to run your SAVE file or open a file-selection dialog, depending on the value of the SAVEFILE keyword. You can edit the `.app` file using the AppleScript editor.

A text version of the script named `Appname_mac_script_source.txt` is also saved in the same directory as the `.app` file. You can delete the `.txt` file or copy it into the AppleScript editor if you want to modify the script.

### Copy and Rename the Applescript Files

Use the Finder to copy the files

IDL_DIR/bin/make_rt/start_app_mac.app

IDL_DIR/bin/make_rt/Utils_applescripts.scpt

(where `IDL_DIR` is your IDL installation directory) to the location of your runtime distribution. If you want, rename `start_app_mac.app` to reflect the name of your application. For example, if your application is named `HydroPlot`, you could rename the `start_app_mac.app` file as `hydroplot.app`. Do not rename `Utils_applescripts.scpt`.

### Modify the start_app_mac.app File

Use the Applescript editor to modify the value of the `idlApp` and `idlDir` variables in the `start_app_mac.app` file (or whatever you have renamed it) as shown below:

(* Specify the path to the IDL SAVE file that launches the virtual

machine application, relative to the location of the script *)

set idlApp to "my_app.sav" as string

(* Specify the path to the top directory of the IDL distribution,

relative to the location of the script. *)

set idlDir to "idl82" as string

where the IDL installation is in the directory `idl82` and the application is in a SAVE file named `my_app.sav`.

By default, the `start_app_mac` script will launch IDL in 64-bit mode if possible. To force IDL to launch in 32-bit mode (if, for example, your application uses DICOM features or the IDL Advanced Math and Stats IMSL libraries), edit the line in the `start_app_mac.app` file that looks like

    set idlCmd to IDLDirFolder & "bin/idl -vm=" & myAppPath

to include the `-32` flag as shown in the file comments.

## Linux/Solaris Launch Script

The `bin/make_rt` subdirectory of the IDL installation directory includes a bourne shell script that you can use to launch your application. To use the script, follow the steps outlined below.

Note: If you use the MAKE_RT procedure, the launch scripts are copied to your runtime distribution automatically. The `start_app_unix` file is renamed to match the Appname argument and modified to run your SAVE file or open a file-selection dialog, depending on the value of the SAVEFILE keyword.

### Copy and Rename the start_app_unix File

Copy the file

IDL_DIR/bin/make_rt/start_app_unix

(where `IDL_DIR` is your IDL installation directory) to the location of your runtime distribution. If you want, rename `start_app_unix` to reflect the name of your application. For example, if your application is named `HydroPlot`, you could rename the `start_app_unix` file as `hydroplot`.

### Modify the start_app_unix File

Using a text editor, modify the value of the `idlapp` and `IDL_DIR` variables in the `start_app_unix` file (or whatever you have renamed it) as show below:

# Specify the path to the IDL SAVE file that launches
# the Virtual Machine application, relative to $topdir.
idlapp=$topdir/my_app.sav

# Specify the path to the top directory of the IDL
# distribution, relative to $topdir.
IDL_DIR=$topdir/idl82 ; export IDL_DIR

where the IDL installation is in the directory `idl82` and the application is in a SAVE file named `my_app.sav`.

Note: If you use the MAKE_RT procedure and specify a value for the SAVEFILE keyword, the `start_app_unix` file is rewritten to launch your application.