The IDL_IDLBridge::Execute procedure method causes the child IDL process to execute a given IDL command. There are two possible modes in which this can be done:

  • Synchronous: IDL waits until the child process completes the specified operation before IDL_IDLBridge::Execute returns. (Execution will halt in the main process if an error is generated. This is the default operation.
  • Asynchronous: The call to IDL_IDLBridge::Execute returns immediately, and the caller can use the IDL_IDLBridge::Status method to track its progress. In addition, the IDL_IDLBridge::OnCallback method (and CALLBACK procedure) will be called automatically when the command is completed. This mode of overlapped execution can be used to perform expensive computations and visualizations in parallel with the main IDL process. Asynchronous operation is specified via the NOWAIT keyword.

A process that presents a user interface (such as a dialog in the child process or the workbench interface in the main process) will typically execute time-consuming commands asynchronously to allow access to the user interface during processing. If execution requires a noticeable amount of time (which can vary depending on the process and your expectations), specify the NOWAIT keyword to maintain user interface responsiveness during command execution.

Once Execute launches the child process only the IDL_IDLBridge::Status method can interact with the process. You can call IDL_IDLBridge::SetVar or IDL_IDLBridge::GetVar before or after, but not during command execution. Attempting to get variables from or pass variables to a currently executing child process will generate an error.

In asynchronous mode, IDL execution will throw an error in the parent IDL process if you attempt to modify variables or execute a second command (in the same child session) before execution of the first command completes. The error “The object's associated IDL process is currently busy.” appears. A child process performs asynchronous operations in the sense that it lets you continue to interact with the parent process or other child processes, but the child process itself executes commands synchronously. For an example of how to avoid such an error, see Avoiding Busy Execution Errors, below.

Note: This method is disabled in IDL Virtual Machine mode.


Obj->[IDL_IDLBridge::]Execute, IDLStmt [, /NOWAIT]



A string containing an IDL command to be executed by the child IDL process.



Set this keyword to cause IDL_IDLBridge::Execute to return immediately, rather than waiting for the child process to complete. When NOWAIT is set, the parent IDL process continues to execute in parallel with the child process.


The following example creates an IDL_IDLBridge object and executes a simple command to display data:

oBridge = OBJ_NEW('IDL_IDLBridge')
oBridge->Execute, 'WINDOW, XSIZE=300, YSIZE=300'
oBridge->Execute, 'TV, DIST(300)'

Note that the argument to the Execute method is always a string containing an IDL command. This command is parsed and executed by the child IDL process in the usual way—much as if it had been entered at the IDL command line by an interactive user.

When constructing a command string to pass to the Execute method, it is important to clearly delineate between the parent and child IDL processes, which are separate IDL instances and do not share a common environment. For example, assume that the parent process has a variable named curindex containing the numeric index of the current plot. In a standard IDL session, you could use the following simple IDL command to add the index value to a window title string:

WINDOW, TITLE='Process ' + STRING(curindex)

It might be tempting to send this command to the IDL_IDLBridge child process in order to achieve the same effect:

oBridge->Execute, $
   "WINDOW, TITLE='Process ' + STRING(curindex)"

This will fail however: curindex is a variable in the parent IDL process, but not in the child process. Instead, we must make a subtle alteration such that the string concatenation is performed by the parent rather than the child process:

oBridge->Execute, $
   "WINDOW, TITLE='Process " + STRING(curindex) + "'"

Alternatively, we could use the IDL_IDLBridge::SetVar method to send the curindex variable to the child process. This might be a better choice if the value of curindex was needed there for other purposes in addition to constructing a window title, but in this simple example, it is better to do the work locally.

Avoiding Busy Execution Errors

Calling the Execute, GetVar or SetVar method on a currently executing child process causes the parent IDL process to throw an error:

The object's associated IDL process is currently busy

To avoid this condition, use the IDL_IDLBridge::Status method to make sure the child process is in the idle state (0) before calling the Execute method:

IF (oBridge->Status() EQ 0) THEN $
   oBridge->Execute, 'IDLStmt'

Executing a Batch File in a Child Process

A child process can execute batch files in the same manner as the parent IDL process. For example, the following batch file, plot06, is in the IDL path:

oBridge->EXECUTE, '@plot06' 

However, your startup file is not automatically executed when a new IDL child process is created. To manually call your startup file, use the following code:


Note: See Examples for addition examples of using the Execute method.

Version History