From WikiChip
$tempfn identifier - mIRC
< mirc‎ | identifiers

$tempfn returns a temporary filename in the $mircdir using the same filename mask used by mIRC internally, such as for the /write command. Now accepts an optional pathname as an alternate folder location.

Synopsis[edit]

$tempfn
$tempfn([path])

Parameters[edit]

None or [path] = absolute or relative foldername for the temp file. If path not provided, default is $mircdir, and any path provided MUST exist. If Parenthesis is used is blank path, returns $null.

Properties[edit]

None

Example[edit]

//echo -a $tempfn

It does not create the disk filename, but offers the string as a "safe" filename that can be used without it already existing as a disk file or foldername.

The string returned is $mircdir $+ mirc $+ $rand(0,$calc(2^31-2)) $+ .tm_

Note: The filename mask is the same used internally by mIRC for disk write fuctions, such as in the /write command.

//echo -a $tempfn(temp)

Same except the string lists the filename's path as being in the temp subfolder beneath $mircdir. Halts with error if that foldername doesn't exist. Handles strings like ".." or "c:" or "\path" the same way as $findfile.

It is up to the user to use a folder where you have write permissions for actually creating the file. If D: is a DVD drive, $tempfn(D:\) returns a string containing D:\ as the path, even if the disk write would fail.


Compatibility[edit]

Added: mIRC v7.46
Added on: 01 Aug 2016
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See also[edit]