Startup File

A startup file is a batch file that is executed automatically each time the IDL is started. The name of the startup file is specified by the IDL_STARTUP preference. You can set the value of this preference manually (see IDL System Preferences (IDL Reference Guide) for information on IDL's preferences system) or using the "IDL" page of the IDL Workbench Preferences dialog.

Common uses for startup files include the following:

Startup files are executed one statement at a time. It is not possible to define program modules (procedures, functions, or main-level programs) in the startup file. For more information on creating batch files, see Executing Batch Jobs in IDL (Application Programming).

Understanding When Startup Files are Not Executed

Startup files are executed only when a command line is present. (Prior to IDL 6.2, IDL would execute the startup file specified by the environment variable IDL_STARTUP even if no IDL command line was present.) Now, however, the startup file is not executed when running the following types of applications:

In most cases the new behavior is desirable; you as the developer of an IDL application do not necessarily know whether the end user of your application has an IDL startup file.

If, however, you are creating an application that relies on settings defined in a startup file, you have the following options:

Manually Executing a Startup File

To explicitly execute the startup file after an IDL process has been started (either through the IDL_IDLBridge object or a Connectivity Bridge wrapper object), complete the following steps:

  1. Create a string variable containing the "@" character concatenated with the name of the startup file:
  2. startup_file = '@' + PREF_GET('IDL_STARTUP') 
    
  3. Using the appropriate "execute string" functionality for your application to execute the string variable.