The RunTask method displays a dialog where users can select parameters for a given ENVITask. This method is similar to SelectTaskParameters except that it:

  • Automatically runs the task after the user clicks OK.
  • Presents a dialog that is not modal.
  • Lets the user choose to run the task on an ENVI Server.

The ENVITask that you pass as an argument to this method will not change its input or output parameters as a result of users interacting with the task dialog.


; Launch the application
e = ENVI()
; Create an NNDiffuse pan sharpening ENVITask
; Get the task from the catalog of ENVITasks
Task = ENVITask('NNDiffusePanSharpening')
; Display the task dialog and run the task
e.UI.RunTask, Task


ENVIUI.RunTask, Task [, Keywords=value]

Return Value

This method returns "OK" if the user accepted the setting from the dialog, or it returns "Cancel" if the user canceled from the dialog.



The ENVITask object


Keywords are applied only during the initial creation of the object.


Set this keyword to a named variable that will contain any error message issued during execution of this routine. If no error occurs, the ERROR variable will be set to a null string (''). If an error occurs and the routine is a function, then the function result will be undefined.

When this keyword is not set and an error occurs, ENVI returns to the caller and execution halts. In this case, the error message is contained within !ERROR_STATE and can be caught using IDL's CATCH routine. See IDL Help for more information on !ERROR_STATE and CATCH.

See Manage Errors for more information on error handling in ENVI programming.

MODAL (optional)

Set this keyword if you want the task dialog to be modal and block the program execution. By default, the dialog is not modal.


Set this keyword to make the Display Result option visible in the task dialog. It is set by default.

SHOW_PREVIEW (optional)

Set this keyword to make the Show Preview option visible in the task dialog. By default, ENVI will determine if the task result can be previewed.

STYLE_SHEET (optional)

Set this keyword to a filename or hash that contains a style sheet. A style sheet defines the user interface elements (for example, text boxes and color pickers) to include in the dialog. By specifying a style sheet, you have more flexibility in choosing UI elements for each input and output parameter for your custom task.

Version History

ENVI 5.6


API Version


See Also

ENVIUI, ENVIUI::SelectTaskParameters, ENVIUI::SelectInputData