Skip to main content

Using Variables in AnzioWin

Starting with version 15, AnzioWin contains a feature for utilizing environment replacement variables. These can be used in most any function that calls or creates a file name or needs a directory path, such as for opening files, file transfers, generating PDFs or TIFs and more. These variables can also be used in AnzioWin's macros and scripting and in commands sent from the host application or script.

This document explores the use of these environment replacement variables. See additional web pages for information on using these variables within file names and macros and scripts.

Macros and scripts

AnzioWin supports user-defined macros and scripts, as well as scripting from the host, sending AnzioWin commands to the PC. These scripts often times will require additional PC related information only available at runtime. This might be the user's default directory, the current date and time, or even the PCs IP address. All this information can be used in scripting with e AnzioWin environment variables.

AnzioWin environment variables get interpreted when the function or call is performed, replacing the variable with the current information available on a specific PC. There are a couple of exceptions to this, such as when setting the output file name for a PDF, this gets interpreted when the next passthrough print job comes along (this is so you can accurately use the print job's date and time if need be).

Typical command from the host

A host application or script could set the file type and naming convention prior to sending down a passthrough print command. This can be done through an AnzioWin-specific command (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_WINNAME   The PC's current Windows name
ANZ_TCPNAME   The PC's current network name
ANZ_LAST_LAUNCH   The name of the program last launched ('start')
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_PROGRAM_EXE   The actual applications executable name
ANZ_WINDOWS_VERSION   Windows version
ANZ_WINDOWS_VERSION_EX   Extended Windows version information
ANZ_PROCESS_ID   AnzioWin's process ID
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_VERSION   AnzioWin version number
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.

ANZ_IP   The PC's IP address
ANZ_HOSTNAME   The host name AnzioWin is connected to
ANZ_USERNAME   The user name AnzioWin connected with
ANZ_PASSWORD   The password AnzioWin connected with (may not be available for certain connection types)
ANZ_TITLE   AnzioWin's window title
ANZ_LAST_RECD   The last file name received by a file transfer
ANZ_LAST_SENT   The last file name sent by a file transfer
ANZ_MAC_ADDRESS   The PC's MAC (machine) address
ANZ_COMTYPE   The communication's type
ANZ_DROP_NAME   The name of the file dropped on a running AnzioWin session
ANZ_HIGHLIGHT   The text highlighted on the AnzioWin window
ANZ_CURSOR_X   The current cursor X position
ANZ_CURSOR_Y   The current cursor Y position
ANZ_ENVIRONMENT   A list of environment variables
ANZ_MAC_ETHERNET   The network card's MAC address
ANZ_MOUSE_WORD   The word under a mouse click
ANZ_MOUSE_X   The X position of a mouse click
ANZ_MOUSE_Y   The Y position of a mouse click
ANZ_SETTINGS_FILE   The current settings file filename
ANZ_KEYS_FILE   The current key file filename
ANZ_CALLERID   The caller ID reported by the TAPI modem driver
ANZ_CALLERID_NAME   The caller's name reported by the TAPI modem driver
ANZ_ISREMOTE   Returns true if accessing over a terminal server
ANZ_REMOTE_SESSION   The remote terminal server session
ANZ_REMOTE_IP   The remote terminal server IP address
ANZ_REMOTE_NAME   The terminal server name
ANZ_REMOTE_STATION   The terminal server station ID

Additionally, any available Windows variable can be used as well. To do this simply include the dollar-sign, the variable name and the ending curly bracket, i.e.

/usr/bin/printf "\034%s\035" 'printer pdf://${TEMP}/${ANZ_DATE_YY}.pdf'

Conclusion

With replacement variables, AnzioWin macros and scripts and the naming of files can be quite useful. This provides a very powerful feature. And a reminder - always test thoroughly before implementing.

Copyright © 2024 Rasmussen Software, Inc. Legal Information & Privacy Policy
Send comments and suggestions to rsi@anzio.com