Command-line Options for IDL Startup

Command-line Options for IDL Startup

You can alter some IDL behaviors by supplying command-line switches along with the command used to invoke IDL. The following table shows the IDL command-line switches and the IDL interfaces to which they apply (See also Language Codes):

Preference Switches

Command-line Switches

The following command-line switches can be used when invoking IDL. Unless otherwise noted, switches can be combined and specified in any order.

-32

Syntax: -32

Starts IDL in 32-bit mode. If this switch is not set, IDL starts in 64-bit mode by default for those platforms that support 64-bit. If you have not installed the 64-bit version, the 32-bit version will automatically be started. If you have not installed the 32-bit version, this flag will not work.

-arg

Syntax: -argvalue

Specifies a single command line option to be passed for subsequent access via the COMMAND_LINE_ARGS function. The value is saved as a string. Multiple -arg switches are allowed; the values are saved in the order specified. The -arg option can be used to pass program-specific information from the command line to IDL programs.

-args

Syntax: -argsvalue1 value2 ... valueN

Specifies one or more command line options to be passed for subsequent access via the COMMAND_LINE_ARGS function. When IDL sees the -args option, it takes any command-line arguments that follow it and passes them all as a string array. There can only be one -args option on an IDL command line, and it is always the final option. The -args switch can be used with the -arg switch; if both switches are specified, occurrences of -arg must come first, and the values specified by -args are saved following any values specified by -arg.

-batch

Syntax: -batch

Specifies a file to be executed in non-interactive batch mode.

-e

Syntax: -eIDL_statement

Specifies a single IDL statement to be executed. Once the statement has executed, IDL waits for any widget applications to exit, and then IDL itself exits. Only the last -e switch on the command line is honored.

Note: If the IDL statement includes spaces, it must be enclosed in quote marks. Under UNIX the statement can be enclosed in either single or double quotes, but under Microsoft Windows the statement must be enclosed in double quotes.

Note: Because the -e switch causes IDL to exit as soon as the statement is complete, if the IDL statement being executed produces graphics, you may wish to delay the exit until the user has a chance to view the graphics. In such a case, you must explicitly cause IDL to wait before exiting. For example, the following will produce a plot of one cycle of a sinusoid:

idlde -e "PLOT, SIN(FINDGEN(628)/100) & t=DIALOG_MESSAGE('Done')"

Note: The plot will remain on the screen until the user dismisses the dialog, at which point IDL will exit.

-nl

Syntax: -nllocale

Selects a different locale (language) to display in the IDL Workbench. Locale is a two-letter ISO language code, such as en (English), or ja (Japanese). See all supported locales.

-pref

Syntax: -pref=file

Loads the specified preference file. The file argument should be a text file containing IDL preference/value pairs. See About IDL System Preferences for a detailed description of IDL's preferences system, the format of preference files, and the precedence given to different sources for preference values.

Note: If a relative path specification is provided for file, the path is relative to the directory from which IDL is started.

This feature is of particular interest to those writing stand-alone applications in IDL, possibly using the runtime or Virtual Machine modes of operation. The use of a command-line preference file allows authors of such applications to control the values of preferences important to their applications in a way that is user-adjustable and not hard-coded in their application.

-quiet

Syntax: -quiet

Suppresses printing of the IDL announcement and the motd.txt file. This switch is supported for Windows idlrt.exe, but it has no effect.

-rt

Syntax: -rt=file

Starts IDL with a runtime license. If the file argument is specified, it should be an IDL .sav file. If the file argument is not specified, IDL attempts to run a file named runtime.sav.

This switch is accepted by the idlrt.exe application on Microsoft Windows platforms, but it is redundant.

-vm

Syntax: -vm=file

Starts the IDL Virtual Machine. If the file argument is specified, it should be an IDL .sav file. If the file argument is not specified, IDL displays a file selection dialog.

Specifying Preferences at the Command Line

In addition to the command-line switches described above, the value of any IDL preference can be specified at the command line using the following syntax:

idlcommand -PREFERENCE value

where idlcommand is the command used to launch IDL (one of idl, idlde, or idlrt), PREFERENCE is the name of an IDL preference (note the leading hyphen), and value is the value for the preference. For example, to set the value of the IDL_MORE preference to one when launching IDL in command-line mode on a UNIX machine, you would use the following command line:

idl -IDL_MORE 1

Any number of preference values can be specified at the command line.

Using Switches under Windows

Under Microsoft Windows, applications can be launched either from the prompt in a Command Window or by double-clicking on the application icon. If you launch IDL from a command prompt, specify the switch after the name of the IDL executable you are using. For example, to start IDL in Virtual Machine mode using the -vm switch, use the following command:

C:\IDL_DIR\bin\bin.platform\idlrt.exe -vm=file.sav

where IDL_DIR is the directory where you have installed IDL, platform is the platform-specific bin directory, and file.sav is the name of the SAVE file you wish to restore and run.

Again, IDL_DIR is the directory where you have installed IDL.

If you launch IDL by double-clicking on the application icon, set the switches by following this procedure:

Right-click the IDL application icon, and select Properties.

The IDL Properties dialog displays.

On the Shortcut tab, add the switches after the executable path in the Target box.

Video Tutorial

Code Library Pick

Revolution IDLRevolution IDL unleashes the power of the IDL Object Graphics architecture by providing a high-level graphical user interface that allows the user to visualize data in a variety of ways, changing properties, positioning objects in 3D, and much more.