Use the GenerateMetatask method to create a metatask from all of the steps in a workflow, including their parameter values. Creating a metatask is useful if you want to export a set of parameters that work well in a workflow, for future use as a single task. The metatask will only contain the ENVITasks and parameters used in the workflow. It will not contain any extra steps, custom user interface (UI) classes, or logic that may have been built into the workflow.


; Start the application
e = ENVI()
; Create an ENVIWorkflow object
workflow = ENVIWorkflow()
; Add a step for performing ISODATA classification
step1 = ENVIWorkflowStep()
step1.TASK = ENVITask('IsodataClassification')
; Add a step for smoothing the classification result
step2 = ENVIWorkflowStep()
step2.TASK = ENVITask('ClassificationSmoothing')
; Connect inputs and outputs
workflow.Connect, step1, 'output_raster', step2, 'input_raster'
; Display the workflow dialog
envi.UI.CreateWorkflowDialog, workflow
; After the user chooses parameter values in the 
; workflow, explort everything to a metatask
metatask = workflow.GenerateMetatask()
; Print the properties of the metatask
Print, metatask, /IMPLIED


Result = ENVIWorkflow.GenerateMetatask([, ERROR=value])

Return Value

This method returns an ENVITask whose base_class key is set to ENVIMETATASK.





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.

Version History

ENVI 5.6


API Version


See Also