Difference between revisions of "Programmer Guide/Command Reference/UNIQUE"

From STX Wiki
Jump to navigation Jump to search
m (1 revision: Initial import)
Line 1: Line 1:
 
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
 
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
==UNIQUE==
+
<var>var</var> := UNIQUE <var>dir</var> <var>ext</var> <var>mode</var> <var>digits</var> [ <var>offset</var> ]</code>
 +
The {{STx}} command <code>UNIQUE</code> returns a unique filename for the specified directory (use "<code>*</code>" for the current working directory). If a directory is specified, it is made the current working directory first.
  
<code>var := UNIQUE <var>dir</var> <var>ext</var> <var>mode</var> <var>digits</var> [ <var>offset</var> ]</code>
+
The unique filename will be returned without its path prefix and without an extension. If, for one reason or the other, {{STX}} should be unable to create a unique filename, it will return the empty string.
 
 
-> var =: 'uniquefilename' without directory and extension or empty string
 
 
 
Generate a unique filename for the specified directory (use '*' for the current working directory). If a directory is specified, it is made the current working directory.
 
  
 
;<var>dir</var>
 
;<var>dir</var>
 
+
:The name of directory or "<code>*</code>" for the current working directory.
:The name of directory or '<code>*</code>'.
 
 
 
 
;<var>ext</var>
 
;<var>ext</var>
 
 
:The file extension.
 
:The file extension.
 
 
;<var>mode</var>
 
;<var>mode</var>
 
+
:When supplying <code>0</code> for the <var>mode</var> argument, {{Stx}} will generate the filename by using an internal decimal counter. When, on the other hand, supplying <code>1</code> for <var>mode</var>, {{STX}} will use a hexadecimal random number.
:<code>0</code> = count (decimal), <code>1</code> = random numbers (hex).
 
 
 
 
;<var>digits</var>
 
;<var>digits</var>
 
+
:The number of digits to use in the unique filename.
:The number of filename digits.
 
 
 
 
;<var>offset</var>
 
;<var>offset</var>
 
+
:The first index (for counter mode only).
:The first index (for count mode only).
 

Revision as of 15:45, 7 May 2014

var := UNIQUE dir ext mode digits [ offset ]

The STx command UNIQUE returns a unique filename for the specified directory (use "*" for the current working directory). If a directory is specified, it is made the current working directory first.

The unique filename will be returned without its path prefix and without an extension. If, for one reason or the other, STx should be unable to create a unique filename, it will return the empty string.

dir
The name of directory or "*" for the current working directory.
ext
The file extension.
mode
When supplying 0 for the mode argument, STx will generate the filename by using an internal decimal counter. When, on the other hand, supplying 1 for mode, STx will use a hexadecimal random number.
digits
The number of digits to use in the unique filename.
offset
The first index (for counter mode only).