Knowledgebase article File naming options in AnzioWin
Starting with AnzioWin version 15, file names used by AnzioWin can contain predetermined variable names that will get substituted for when the file is called or created.
Likewise, certain AnzioWin macro and script commands can contain and utilize these same replacement variables when the macro is executed.
This document covers the use of these environment replacement variables within the context of file names. See additional web pages for information on using these variables within macros and scripts.
One place where these are very useful is in the generation of both TIFF and PDF files from passthrough print jobs. Running these type of jobs can set the job up to simply increment an unique sequence number within the file name. These may not be very meaningful to the user and even less meaningful if they are going to be archived or emailed.
Fortunately we do have a few options to help force your own naming convention on new file names.
How the defaults work
There is a default file names used within AnzioWin when generating output files from print jobs. AnzioWin uses a file name predetermined file name, usually "Printwiz_Output", plus the appropriate extension, when creating a new file. As an example, when a PDF is generated by AnzioWin and no default file name was specified, the following would be the result:
Printwiz_Output.pdf
If the file does exist, the file name will be incremented with a 4 digit number for each duplicate file name:
Printwiz_Output0001.pdf
We create these files in AnzioWin's current working directory.
How to expand the file name
Custom file naming conventions are an easy way to separate one print job from another. These print jobs often come from applications or host system with no name information since they are meant to be printed.
AnzioWin has a solution. First, an output file name for AnzioWin can be specified by the host system or application by sending down an initial string setting the output type and name. Second, the user can set a default for the print-to name within the AnzioWin "printer-setup" dialog under the File menu. These file names can contain one or more replacement variables that represent runtime data, rather than hard-coded file names.
Below we discuss these methods and then we follow it up with a table of variables available for file names.
A. From "Printer setup"
In order to specify a file name, you do so through the Printer Setup dialog under the File menu. Here you can set defaults to use for PDF and TIFF generation, including setting the output directory and file naming convention. As an example, you might want the file name to contain today's date and be located in a archival directory:
"C:\Archived_PrintJobs\salesreport_${ANZ_DATE}.pdf"

This example shows setting the default for printing to be directed to a PDF with the date as part of the name.
B. From the host
A host application or script could also set the file type and naming convention prior to sending down a passthrough print command. This is done as an AnzioWin-specific command embedded within a certain hex sequence (for more information on host programming of AnzioWin, check out the Scripting AnzioWin from the Host knowledgebase article).
A host command might look like the following BASH script:
# First set the default printer type and a file name including the year and date
echo -e '\034printer "pdf://c:\\temp\\${ANZ_DATE_YY}_${ANZ_DATE_MM}.pdf" \$035"
# Now print the job
# ...
Note that in version 16 or higher you may be able to replace the back-slashes, which can be troublesome in some scripts, with a single forward-slash.
Likewise, on many UNIX / Linux operating systems, you can use the /usr/bin/ version of printf and separate the string into a different variable surrounded by single-quotes. This prevents back-slashes from being interpreted by the printf command, such as:
/usr/bin/printf "\034%s\035" 'printer pdf://c:\temp\${ANZ_DATE_YY}.pdf'
Expansion options
The table below lists the available replacement variables that can be used with AnzioWin. Some of these may not make sense to use in certain situations and may indeed be empty. Please test thoroughly before putting these into use.
| Variable |
|
Description |
| ANZ_WINDIR |
|
Where Windows is installed |
| ANZ_SYSDIR |
|
Windows system directory |
| ANZ_CURDIR |
|
AnzioWin's current working directory |
| ANZ_DOWNDIR |
|
AnzioWin's current download directory |
| ANZ_COMPUTERNAME |
|
The computer's name |
| ANZ_MY_DOCS |
|
User's document directory, "My Documents" |
| ANZ_COMMON_DOCS |
|
Shared document directory |
| ANZ_DESKTOP |
|
Windows desktop |
| ANZ_PROGRAM_FILES |
|
Windows "Program Files" directory |
| ANZ_PROGRAM_DIR |
|
AnzioWin's program directory |
| ANZ_APPDATA |
|
User's application data working directory |
| ANZ_COMMON_APPDATA |
|
Windows' application data working directory |
| ANZ_USERDATA |
|
User's default data directory |
| ANZ_COMMON_USERDATA |
|
Windows' default data directory |
| ANZ_DATE |
|
Windows current date. This can also specify portions of the date. Some examples might be as follows:
ANZ_DATE_YYYY
ANZ_DATE_YY
ANZ_DATE_MM
ANZ_DATE_DD
ANZ_DATE_YYMMDD
|
| ANZ_TIME |
|
Specified Windows current time. This can also specify portions of the current time. Some examples might be as follows:
ANZ_TIME_HH
ANZ_TIME_MM
ANZ_TIME_HHMM
|
| ANZ_DOCNAME |
|
The passed document name |
| ANZ_DOCPATH |
|
The path where the document originated from |
| ANZ_DOCEXT |
|
The original document extension |
| ANZ_UNIQ_9999 |
|
This represents a "uniquified" sequential number, whenever a file exists already, this will up the sequence number till it finds the next available file name to use. You can vary the length of the "9999" when specifying this option, such as
ANZ_UNIQ_99. |
Additionally, any available Windows environment variable can be used as well. To do this simply include the dollar-sign, the left curly bracket, the variable name and the right curly bracket, i.e.
/usr/bin/printf "\034%s\035" 'printer pdf://${TEMP}/${ANZ_DATE_YY}.pdf'
Conclusion
AnzioWin is set to utilize certain defaults when creating a file name and no file name is passed. It also utilizes defaults based on the file name being printed when one is provided.
With replacement variables included in the file name, AnzioWin will do certain substitutions of these variables for both path and file name.
This provides a very powerful feature for naming your files. And a reminder - always test thoroughly before implementing.
|