Coyote's Guide to IDL Programming

Creating a Run-Time IDL Application

QUESTION: I want to have the user start a stand-alone IDL application by double clicking an icon on the display of my Windows machine. Can you show me how to do that in IDL?

ANSWER: First of all, you should know that it is not possible in IDL to create a stand-alone IDL executable. That is, it is not possible to create an IDL program that is capable of being run by someone who doesn't have an IDL license. (See Can I create an IDL executable file? for additional information.)

It is possible, however, to create an IDL application on a Windows machine that runs when the application icon is double clicked. The secret is to use the IDL run-time license that is part of the IDL Windows distribution. Here are the steps I go through to make such an application on my Windows NT machine.

Step 1:

I write a main program that calls my application program. (This main is not strictly necessary, but I find it makes it easier to automate the application building process.) Suppose I want to make a stand-alone application from the XSurface program (an example program that can be downloaded from my web page). I write the Main program like this:
   PRO Main


Step 2:

Open a new IDL session and type these commands:
   IDL> .Compile Main
   IDL> Resolve_All
Since this is a program that uses objects, I must also explicitly compile all of my 'object' files, since Resolve_All doesn't think about these files:
   IDL> .Compile Trackball__Define

Step 3:

Save all the compiled modules in a "save" file:
   IDL> Save, /Routines, Filename='main.sav'

Step 3.5:

This step added at the request of Eric Frans, who struggled with this for hours before Dick Jackson bailed him out. Be sure your path does not have any blank characters in it. For example, the path to the save file cannot be "C:\RSI\Program Files\main.sav". This is a bug in all versions of IDL up to IDL 5.2 Beta 2, the last version we checked.

Step 4:

Exit IDL.

Step 5:

If I just want to run the XSurface application, I can now just double-click the main.sav program name with my mouse. If you have difficulty with this step it may be because the sav file extension is not associated with the run-time version of IDL in the Windows Registry. If it is not, open the NT Explorer application, find the View|Options menu, go to the File Types tab, and make sure the association is set up correctly. (I believe, although I am not sure, that in Windows 95 the File Types association may be accessed from a Control Panel program rather from the File Manager. See your Windows 95 documentation.)

Step 6:

If I want to make this file have a different icon (i.e., an "application" icon), I make a shortcut to the main.sav file. Then I right-click on the shortcut, select the Properties menu item, select the Shortcut tab, and click the Change Icon button to select an icon more indicative of my application. I probably also give the shortcut a really nifty name, like PowerVis or something really exciting. :-)

Step 7:

When I run the application, it is as if I were running a built-in application such as Photoshop. There is no evidence of the IDL Development Environment or, for that matter, IDL at all.

Web Coyote's Guide to IDL Programming