ITT Rule IDL Version 7.0 User Manual

Page of 430
392
Appendix A: Controlling iTools from the IDL Command Line
Running Operations
iTool Developer’s Guide
When executing operations using the mechanisms described in this chapter, you may 
want to set the SHOW_EXECUTION_UI property to 0 (False), since leaving it set to 
True will require user interaction. To change the value of the property temporarily, 
you could use statements similar to the following to first retrieve the value of the 
property, save that value, and set it back after the operation has executed:
idTool = ITGETCURRENT(TOOL=oTool)
idMedian = oTool->FindIdentifiers('*median*', /OPERATIONS)
oMedian = oTool->GetByIdentifier(idMedian)
oMedian->GetProperty, SHOW_EXECUTION_UI=init_val
oMedian->SetProperty, SHOW_EXECUTION_UI=0
success = oTool->DoAction(idMedian)
oMedian->SetProperty, SHOW_EXECUTION_UI=init_val
Notice that we retrieve an object reference to the Median operation and use the 
SetProperty method rather than the DoSetProperty method to set the value of the 
SHOW_EXECUTION_UI property. We do this because we do not want the last call 
to SetProperty to be placed in the undo-redo buffer. Since the call to the DoAction 
method will place all outstanding changes into the undo-redo buffer, all of the 
changes except for the very last are undoable. But since the last line simply sets the 
value of the SHOW_EXECUTION_UI property back to its initial value, there is no 
need to place this change in the undo-redo buffer as a separate item — in fact we 
would rather it not be placed in the buffer at all.
If we used DoSetProperty for the final change, the change would be placed in the 
undo-redo buffer the next time actions were committed, either by a call to DoAction 
or by a call to CommitActions.
Note
We could have used the GetPropertyByIdentifer and SetPropertyByIdentifier 
methods rather than the GetProperty and SetProperty methods. This would not 
affect the outcome of the series of statements shown, and since the name of the 
property whose value we are getting and setting is fixed, using GetProperty and 
SetProperty works just as well.