From WikiChip
Difference between revisions of "mirc/identifiers/$tempfn"
< mirc‎ | identifiers

m (Compatibility: Remove extra version.)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{mirc title|$tempfn identifier}}'''$tempfn''' returns a temporary filename in the {{mIRC|$mircdir}} using the same filename mask used by mIRC internally, such as for the {{mIRC|/write}} command.
+
{{mirc title|$tempfn identifier}}'''$tempfn''' returns a temporary filename in the {{mIRC|$mircdir}} using the same filename mask used by mIRC internally, such as for the {{mIRC|/write}} command. Now accepts an optional pathname as an alternate folder location.
 
== Synopsis ==
 
== Synopsis ==
 
<pre>$tempfn</pre>
 
<pre>$tempfn</pre>
 +
<pre>$tempfn([path])</pre>
 
== Parameters ==
 
== Parameters ==
 
None
 
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 ==
 
== Properties ==
 
None
 
None
Line 9: Line 12:
 
<pre>//echo -a $tempfn</pre>
 
<pre>//echo -a $tempfn</pre>
  
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.
+
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,999998) $+ .tm_
+
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.
 +
 
 +
<pre>//echo -a $tempfn(temp)</pre>
 +
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.
  
'''Note:''' The filename mask is the same used internally by mIRC for disk write fuctions, such as in the /write command. If a file you /write to disappears, it's possible that it exists in the same folder with a filename matching the wildcard mirc*.tm_.
 
  
 
== Compatibility ==
 
== Compatibility ==
 
{{mIRC compatibility|7.46}}
 
{{mIRC compatibility|7.46}}
 +
 
== See also ==
 
== See also ==
 
* {{mIRC|$mircdir}}
 
* {{mIRC|$mircdir}}

Latest revision as of 18:18, 23 January 2024

$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]