Calculates a unique file name to be used for a temporary file
Supported Platforms: Windows, Mac OS, and Web
Signature
(vl-filename-mktemp [pattern directory extension])
- pattern
-
Type: String
File name pattern; if nil or absent, vl-filename-mktemp uses “$VL~~”.
- directory
-
Type: String
Directory for temporary files; if nil or absent, vl-filename-mktemp chooses a directory in the following order:
- The directory specified in pattern, if any.
- The directory specified in the TMP environment variable.
- The directory specified in the TEMP environment variable.
- The current directory.
- extension
-
Type: String
Extension to be assigned to the file; if nil or absent, vl-filename-mktemp uses the extension part of pattern (which may be an empty string).
Return Values
Type: String
A textual value containing a file name, in the following format:
directory\base<XXX><.extension>
where:
base is up to 5 characters, taken from pattern
XXX is a 3-character unique combination
All file names generated by vl-filename-mktemp during a session are deleted when you exit the application.
Release Information
- AutoCAD R14 and later on Windows
- AutoCAD 2011 and later on Mac OS
Releases:
History
- pattern, directory and extension arguments previously accepted ASCII text strings, but they now accept Unicode text strings.
- Return value was modified to support Unicode characters and might be different than earlier releases. For example, (vl-filename-mktemp "myapp" "c:\\abc中") previously returned a temporary file name in the path identified by the directory argument, but now correctly returns a temporary file name based on the directory provided to the function.
- LISPSYS system variable controls which AutoLISP engine is used and the behavior of the function.
- 0 - ASCII character support (legacy behavior)
- 1 or 2 - Unicode character support
Note: After the value of the LISPSYS system variable has been changed, AutoCAD must be restarted for the change to take affect.
AutoCAD 2021
Examples
- Windows
-
(vl-filename-mktemp) "C:\\TMP\\$VL~~004" (vl-filename-mktemp "myapp.del") "C:\\TMP\\MYAPP005.DEL" (vl-filename-mktemp "c:\\acadwin\\myapp.del") "C:\\ACADWIN\\MYAPP006.DEL" (vl-filename-mktemp "c:\\acadwin\\myapp.del") "C:\\ACADWIN\\MYAPP007.DEL" (vl-filename-mktemp "myapp" "c:\\acadwin") "C:\\ACADWIN\\MYAPP008" (vl-filename-mktemp "myapp" "c:\\acadwin" ".del") "C:\\ACADWIN\\MYAPP00A.DEL"
- Mac OS and Web
-
(vl-filename-mktemp) "/documents/$VL~~001" (vl-filename-mktemp "myapp.del") "/documents/MYAPP002.DEL" (vl-filename-mktemp "/myutilities/temp/myapp.del") "/myutilities/temp/MYAPP003.DEL" (vl-filename-mktemp "/myutilities/temp/myapp.del") "/myutilities/temp/MYAPP004.DEL" (vl-filename-mktemp "myapp" "/myutilities/temp") "/myutilities/temp/MYAPP005" (vl-filename-mktemp "myapp" "/myutilities/temp" ".del") "/myutilities/temp/MYAPP006.DEL"