This topic describes where to save custom task files on a local desktop system so that ENVI automatically recognizes them.

A recommended method is to copy your custom task files into the custom_code directory of the ENVI installation path. For Windows systems, the default path is INSTALL_DIR\ENVIxx\custom_code. For Linux systems, the default path is /usr/local/INSTALL_DIR/envixx/custom_code. Copy the following files here:

  • The IDL program (.pro) containing the data-processing algorithm
  • The task template (.task)
  • Optional: The style template (.style) if you need to override the default dynamic UI settings for your task

However, administrator privileges are required to save files in this directory. If you do not have administrator or write privileges, consider the other following options.

ENVI_CUSTOM_CODE Environment Variable


If you choose to save the custom task files to a specific directory, set the ENVI_CUSTOM_CODE environment variable to that location. This option is useful for installing shared custom tasks in environments where the ENVI custom_code directory does not have write permission.

The following instructions pertain to Windows systems:

  1. Click the Start menu.
  2. In the Search window, type environment.
  3. Click Edit environment variables for your account. The System Properties dialog appears with the Advanced tab active.
  4. Click the Environment Variables button.
  5. In the User Variables section, click the New button.
  6. In the Variable name field, enter ENVI_CUSTOM_CODE.
  7. In the Variable value field, enter the path to the custom task files.
  8. Click OK in the Environment Variables dialog.

Application User Directory


Another option is to save the custom task files to a directory under the application user directory. Custom tasks placed here are only accessible by the user account under which they were installed. You can change this directory using the Custom Code Directory entry in the ENVI Preferences dialog or by using the ENVIPreferences API routine.

The following are examples of application user directories, where x_x indicates the software version:

Windows: C:\Users\username\.idl\envi\custom_codex_x

Linux: /home/username/.idl/envi/custom_codex_x

IDL Packages


If an IDL package that contains ENVI code has been installed, its directory (defined by the IDL_PACKAGE_PATH preference) may contain an additional envi_tasks subfolder. When ENVI starts, it searches for and recognizes tasks that are installed in the envi_tasks folder. See the IPM topic in IDL Help for details.

Local File Path


When invoking the ENVITask function, you can specify a file path to the name of the custom task; for example:

Task = ENVITask('C:\CustomTasks\CustomISODATAClassification.task')

This option is useful when you are making changes to the task and need to re-load it in the current IDL session. Be sure that the IDL program associated with the custom task is in the IDL path.

Search Order


When ENVI starts, it searches the aforementioned locations (and their subfolders) for custom tasks, in the following order:

  1. ENVI_CUSTOM_CODE environment variable
  2. ENVI custom_code directory
  3. Application User Directory
  4. IDL packages

If multiple tasks of the same file are discovered in different locations, the first one discovered will be used. Any custom tasks that have the same name as existing ENVITasks will override those tasks. For example, if you create a custom task named "QUAC" and deploy it to a custom directory, ENVI will load your task instead of the ENVI implementation of QUAC.

ENVI discovers new custom tasks when you issue ENVI.task_names at the IDL/ENVI command line, or if you re-launch ENVI.

Issue a .RESET command or re-launch IDL after deploying a custom task to any of these locations.