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

(Create content for empty page)
 
m (Compatibility: Remove extra version.)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{mirc title|$tempfn Identifier}}
+
{{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.
The '''$tempfn''' returns a temporary filename in the {{mIRC|$mircdir}} using the same filename mask used by mIRC for the {{mIRC|/write}} command.
 
 
 
 
== 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 ==
 +
None
 +
== Example ==
 +
<pre>//echo -a $tempfn</pre>
  
== Example ==
+
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_
  
<pre>
+
'''Note:''' The filename mask is the same used internally by mIRC for disk write fuctions, such as in the /write command.
//echo -a $tempfn
 
</pre>
 
  
It does not create the filename, but offers the filename as a "safe" filename that can be used without mIRC using the same filename.<br />
+
<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.
  
String returned is $mircdir $+ mirc $+ $rand(100000,999999) $+ .tm_
+
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 is safe from being re-used by mIRC in the near future. The fact that your $mircdir isn't littered with .tm_ files means that mIRC cleans up these temp files, either at QUIT or START. If a file you /write to disappears, it's possible that it exists in the same folder with a different N.
 
  
 
== Compatibility ==
 
== Compatibility ==
Line 25: Line 29:
 
== See also ==
 
== See also ==
 
* {{mIRC|$mircdir}}
 
* {{mIRC|$mircdir}}
[[Category:MIRC identifiers]]
 

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]