Hi Rogerio,
I hope that the following information might be helpful for you.
- Peg
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CREATING AN IDL SAVE FILE TO USE WITH THE IDL VIRTUAL MACHINE
CONTENTS:
A) HOW TO COMPILE AN IDL APPLICATION SAVE FILE TO USE WITH IDL VIRTUAL MACHINE
B) EXPORT AN IDL VM DISTRIBUTION WITH YOUR APPLICATION
C) DISTRIBUTING YOUR IDL VM APP AND EXPORTED IDL DISTRIBUTION ON REMOVABLE MEDIA
========================================
A) HOW TO COMPILE AN IDL APPLICATION SAVE FILE TO USE WITH IDL VIRTUAL MACHINE ========================================
1) Create a new IDL project
a) From the IDL Workbench select the following menu item:
File -> New -> IDL Project
b) A New IDL Project dialog will appear. Enter/select the following settings:
* Enter Name: myapp
* Select Location radio button: "Create the new project in the workspace"
* Select checkbox: "Update IDL path when project is opened or closed"
* Click Finish button.
2) Create an IDL program
a) From the Workbench menu select:
File -> New IDL Source File
b) Then copy and paste the following code into the resulting new editor view:
;;; BEGIN PROGRAM ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This example program was derived from the program listed in ;; the IDL 7.1 Online Help located at the contents section:
;;
;; IDL 7.1 Programmers' Guides > Application Programming >
;; Part I: Application Programming >
;; Creating SAVE Files of Programs and Data >
;; Creating SAVE Files of Program Files >
;; Example: A Save File of a Simple Widget Application
;;
;; The program was altered so that it does not require ;; an external image data file to run.
;;
PRO done_event, ev
; When the 'Done' button is pressed, exit
; the application.
WIDGET_CONTROL, ev.TOP, /DESTROY
END
PRO myApp
; Create some image data
image = BYTSCL(HANNING(400, 400))
; Apply a color table to be used
; to display the image data
DEVICE, GET_DECOMPOSED=orig_decomp
DEVICE, DECOMPOSED=0
TVLCT, /GET, red, green, blue
LOADCT, 5
; Find the dimensions of the image.
info = SIZE(image,/DIMENSIONS)
xdim = info[0]
ydim = info[1]
; Create a base widget containing a draw widget
; and a 'Done' button.
wBase = WIDGET_BASE(/COLUMN)
wDraw = WIDGET_DRAW(wBase, XSIZE=xdim, YSIZE=ydim)
wButton = WIDGET_BUTTON(wBase, VALUE='Done', EVENT_PRO='done_event')
; Realize the widgets.
WIDGET_CONTROL, wBase, /REALIZE
; Retrieve the widget ID of the draw widget.
WIDGET_CONTROL, wDraw, GET_VALUE=index
; Set the current drawable area to the draw widget.
WSET, index
; Display some data.
TV, image
; Call XMANAGER to manage the event loop.
XMANAGER, 'myApp', wBase, /NO_BLOCK
; Restore original color decomposed state and color table
DEVICE, DECOMPOSED=orig_decomp
TVLCT, red, green, blue
END
;;; END PROGRAM ;;;
c) After copying the code into the IDL Workbench editor:
i. Highlight/select the editor tab view of your new untitled IDL program code.
ii. From the Workbench menu select File -> Save
iii. In the Save As dialog, select the "myapp" folder.
iv. Then with the File name listed as myapp.pro, click OK to save.
3) Build the IDL project, creating the IDL application save file
To build your application:
a) Open the Project Explorer view (Window -> Show View -> Project Explorer).
b) Find and expand the "+" next to the "myapp" project folder to reveal the file "myapp.pro".
c) Right mouse-click on the "myapp" project folder and then select Build Project. The default project settings will cause a compiled d. program save file to be created.
4) Test the application save file
a) To test your application save file from the Workbench:
i) Right mouse-click again on the "myapp" project folder in the Project Explorer view and select Refresh to reveal the newly created "myapp.sav" file.
ii) Double click on the "myapp.sav" file icon in the Project Explorer view to run the application in a separate, licensed IDL Runtime session.
iii) Dismiss the application GUI that appears.
b) Then to test the application in IDL VM mode:
i) Start an IDL VM session. For example, on Windows, from your IDL development machine, select Start->All Programs->IDL 7.1->IDL Virtual Machine.
ii) Click the splash screen to continue.
iii) In the resulting selection dialog, browse to select the "myapp.sav" file, for example:
C:\Document and Settings\JoeUser\IDLWorkspace71\myapp\myapp.sav
iv) After selecting the file click to open the file. This should cause the application to launch. Dismiss the application.
c) The resulting "myapp.sav" file can be distributed to other users who have installed IDL, to run in an IDL VM session.
5.) Additional information creating SAVE files, and building and running IDL projects can be found in the following Contents section of the IDL 7.1 Online Help:
IDL Workbench Guide > Tasks > Running and Building IDL Projects > Project Build Concepts
IDL Workbench Guide > Tasks > Running and Building IDL Projects
IDL Programmers' Guides > Application Programming > Part I: Application Programming > Creating SAVE Files of Programs and Data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% For the following 2 sections (B, C), additional information about creating a minimal,
% redistributable IDL distribution to run your IDL VM application can be found in the
% IDL 7.1 Online Help under the Contents section:
%
% IDL Programmers' Guides > Application Programming >
% Part III: Creating Applications in IDL > Creating a Runtime Distribution
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
========================================
B) EXPORT AN IDL VM DISTRIBUTION WITH YOUR APPLICATION ========================================
This section guides you through the export of an IDL distribution that will allow you to run your IDL VM app in IDL VM execution mode. The resulting exported IDL distribution for your IDL VM app may then be copied to a CD or compressed into a archive file to be distributed to other users.
Note: If your IDL VM application relies upon example files or other files that are normally included within a regular IDL installation but not be default included in a MAKE_RT exported IDL distribution, you may need to alter the contents of the "manifest_rt.txt" file (located in the idl71/bin/make_rt directory of the IDL 7.1 installation) before running MAKE_RT, so that all of the needed files are included in the exported distribution.
1) Create a destination folder that will ultimately contain an exported IDL distribution which will run your IDL VM application file, "myapp.sav". For example:
C:\Documents and Settings\JoeUser\Desktop\myapp
2) Then from your IDL session, issue a MAKE_RT command to export an IDL distribution and your IDL VM app file. For example, at the IDL> prompt enter the following commands:
appdir = 'C:\Documents and Settings\JoeUser\Desktop\myapp'
savefilepath = 'C:\Documents and Settings\JoeUser\IDLWorkspace71\myapp\myapp.sav'
MAKE_RT, 'myapp', appdir, SAVEFILE=savefilepath, /VM, /OVERWRITE
After the MAKE_RT command completes, a new "myapp" folder will be created within the original "myapp" folder on the Desktop.
Exploring in the "myapp" subdirectory, you'll notice a copy of your "myapp.sav" IDL application file. Additionally in this folder, you'll find an abbreviated IDL distribution tree in the "IDL71" folder.
3) In the "myapp" subdirectory of the "myapp" folder that you created, for Windows you'll find an executable file named "myapp.exe" that, when double-clicked, should launch the myapp application in IDL VM mode. If you create a Mac OS X exported distribution from a Mac machine a clickable AppleScript will be created. For Linux and Solaris, a command line launch shell script will be created.
===========================================
C) DISTRIBUTING YOUR IDL VM APP AND EXPORTED IDL DISTRIBUTION ON REMOVABLE MEDIA ===========================================
Note: For distributing your IDL VM app on removable media, be sure to read the following IDL 7.1 Online Help section:
IDL Programmers' Guides > Application Programming > Part III: Creating Applications in IDL > Creating a Runtime Distribution > Distributing Runtime Applications on Removable Media
1) To distribute your IDL VM application with the exported IDL distribution on removable media, simply copy the exported IDL distribution tree to the removable media. (For this example, you can copy the exported "myapp" subdirectory folder or even just the contents of this folder to the removable media.)
You might also consider including instructions on how to start the IDL VM app in a separate README.txt file, placed at the root directory of the removable media.
2) Alternatively, the IDL VM application and exported IDL distribution can also be packaged into a compressed single archive file to be delivered electronically to end users.
|