Re: Creating and saving an iTool without displaying it [message #50029] |
Wed, 06 September 2006 00:53 |
Nicolas Decoster
Messages: 34 Registered: March 2000
|
Member |
|
|
Chris Torrence a �crit :
> Hi Benjamin,
>
> Yes, there is an undocumented keyword (it's actually documented under
> IDLitSys_CreateTool). If you set USER_INTERFACE="None", then it will not
> display any UI. For example:
>
> iPlot, findgen(10), user_interface='none'
> idTool=itgetcurrent(tool=oTool)
> void = oTool->DoSetProperty('Operations/File/Save', 'filename', 'iplot.isv')
> void = oTool->DoAction('Operations/File/Save')
> void = oTool->DoAction('Operations/File/Exit')
>
> Now before you run off and try this, there is a bug in IDL6.2 and IDL6.3
And the keyword USER_INTERFACE doesn't exists on IDL 6.1. Unfortunately,
I need this kind of functionality with IDL 6.1...
By the way, this functionality is very useful for unit testing.
Nicolas.
|
|
|
Re: Creating and saving an iTool without displaying it [message #50036 is a reply to message #50029] |
Tue, 05 September 2006 11:35  |
Chris[2]
Messages: 39 Registered: August 2003
|
Member |
|
|
Hi Benjamin,
Yes, there is an undocumented keyword (it's actually documented under
IDLitSys_CreateTool). If you set USER_INTERFACE="None", then it will not
display any UI. For example:
iPlot, findgen(10), user_interface='none'
idTool=itgetcurrent(tool=oTool)
void = oTool->DoSetProperty('Operations/File/Save', 'filename', 'iplot.isv')
void = oTool->DoAction('Operations/File/Save')
void = oTool->DoAction('Operations/File/Exit')
Now before you run off and try this, there is a bug in IDL6.2 and IDL6.3
where the "Save" operation will not work correctly if there is no UI. Other
operations such as "Print" and "Export" should work fine. For example, you
could do the following instead:
; Print the window.
; First disable the Print dialog.
void = oTool->DoSetProperty('Operations/File/Print', 'SHOW_EXECUTION_UI', 0)
void = oTool->DoAction('Operations/File/Print')
; Export the window to a JPEG file.
; First disable the Export wizard dialog.
void = oTool->DoSetProperty('Operations/File/Export', 'SHOW_EXECUTION_UI',
0)
; Export the entire window.
void = oTool->DoSetProperty('Operations/File/Export', 'SOURCE', 1)
void = oTool->DoSetProperty('Operations/File/Export', 'FILENAME',
'iplot.jpg')
void = oTool->DoAction('Operations/File/Export')
We are planning on exposing this functionality in a future version of IDL,
as well as fixing the bug with "Save".
-Chris Torrence
ITT Visual Information Solutions
"Benjamin Hornberger" <benjamin.hornberger@stonybrook.edu> wrote in message
news:44f733e9$1_3@marge.ic.sunysb.edu...
> Hi all,
>
> I want to programmatically create an iTool and save it without user
> interaction. I could manage to do that (see below), but is it possible
> without having the tool pop up on the screen at all?
>
> IDL> iPlot,findgen(10)
> IDL> idTool=itgetcurrent(tool=oTool)
> IDL> idSave=oTool->findIdentifiers('*save',/operations,count=count) &
> print, count
> 1
> IDL> oSave=oTool->getByIdentifier(idSave)
> IDL> oSave->setProperty,filename='iplot.isv'
> IDL> print,oTool->doAction(idSave)
> 1
> IDL> idExit=oTool->findIdentifiers('*exit',/operations,count=count) &
> print,count
> 1
> IDL> print,oTool->doAction(idExit)
> 1
>
> Any clues? Thanks,
> Benjamin
|
|
|