The GetTemporaryFilename function method returns a fully qualified path and name of a file located in ENVI's temporary directory. This filename is unique in the file system.

Example


; Launch the application
e = ENVI()
 
; Create an ENVIRaster
file = FILEPATH('qb_boulder_pan', ROOT_DIR=e.ROOT_DIR, $
  SUBDIRECTORY = ['data'])
raster1 = e.OpenRaster(file)
 
; Create a temporary output file
newFile = e.GetTemporaryFilename()
 
; Export a subset of the raster as a TIFF file
subRaster = ENVISubsetRaster(raster1, $
  SUB_RECT=[500,2500,1699,3999])
subraster.Export, newFile, 'TIFF'

Syntax


Result = ENVI.GetTemporaryFilename([Extension] [, Keywords=value])

Return Value


This method returns a string containing the fully qualified path and name of a file in ENVI's temporary directory. This directory is defined by the Temporary Directory setting in the ENVI preferences.

Arguments


Extension

A scalar string denoting the filename extension. If this argument is not supplied, a .dat extension is appended.

Keywords


CLEANUP_ON_EXIT

Set this keyword to delete the file from the Temporary Workspace when ENVI closes.

NFILES

Set this keyword to a scalar integer indicating how many unique filenames to generate and return as a string array. If this keyword is not set, then a single filename is generated and returned as a scalar string.

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

Added CLEANUP_ON_EXIT keyword

API Version


4.2

See Also


ENVI, ENVI::CleanupTemporaryWorkspace