This method has been deprecated. Please refer to ENVIPreferences.

The GetPreference function method returns the current value of an ENVI preference setting.

Example


; Launch the application
e = ENVI()
 
; Create an ENVIRaster
file = FILEPATH('qb_boulder_msi', ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data'])
raster = e.OpenRaster(file)
 
; Retrieve data from original raster that contains only a single band
origData = raster.GetData(BANDS=0)
 
; Write a new file to the output directory
; specified in the preferences
outDir = e.GetPreference('OUTPUT_DIRECTORY')
newRaster = outDir + 'newFile.dat'
 
; Create raster and save it in newFile
newFile = ENVIRaster(origData, URI=newRaster, NBANDS=1)
newFile.Save
 
; Display the new raster
view = e.GetView()
layer = view.CreateLayer(newFile)

Syntax


Result = ENVI.GetPreference(Name [, ERROR=variable])

Arguments


Name

A scalar string that corresponds to a given preference. The string value is not the same as the preference name in the Preferences dialog of the ENVI user interface. The following table lists the valid strings for the Name argument and their corresponding preferences:

Name Value

Preference

autodisplay

Auto Display Files on Open

auxiliary_file_directory

Auxiliary File Directory

extensions_directory

Extensions File Directory

multispectral_autodisplay

Auto Display Method for Multispectral Files

output_directory

Output Directory

temporary_directory

Temporary Directory

working_directory

Input Directory

Keywords


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

ERROR

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

Introduced

ENVI 5.2

Deprecated

See Also


ENVI