The Save method saves ENVI preferences to the JSON file specified by the ENVIPreference URI property.

Preferences that have been modified through the API are not automatically saved when ENVI is closed. After modifying preferences, save them with this method, or save individual preferences using ENVIPreferenceItem::Save.


; Launch ENVI
e = ENVI()
; Modify a few preferences and save them.
prefs = e.Preferences
prefs['data manager:multispectral auto display'].VALUE='CIR'
prefs ['annotations:text:color'].VALUE=[255,0,0]
prefs['display general:zoom factor'].VALUE=2


ENVIPreferences.Save [, Keywords=value]





Set this keyword to the name of a JSON file where preferences will be saved. If this keyword is not specified, preferences will be saved to the JSON file specified by the ENVIPreferences object URI property.

If preferences are saved in a location other than the default JSON file, they will not be loaded when ENVI is launched in future sessions. To load preferences from a location other than the default, call ENVIPreferences::Load with the specified URI. To override the default preferences file throughout the ENVI application (including where preferences are automatically saved) specify the PREFERENCES keyword of ENVI function when launching ENVI


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.2


API Version


See Also

ENVIPreferences, ENVIPreferences::Load, ENVIPreferences::RestoreDefaults, ENVIPreferences::Save