Skip to main content

Scripting AnzioWin from the Host

Introduction

AnzioWin and Anzio Lite contain the ability to be controlled through host scripting. These are small shell scripts or program blocks that can issue and query Anzio from the host end of the connection. This document rdescribes how this works.

We have many examples on our web site and in various whitepapers. Check out our support pages at Anzio.Com

Issuing commands from the host

One of the big benefits of Anzio over other terminal emulation and telnet products is its ability to respond to host commands issued for Anzio.

Commands specifically for Anzio are sent through the Anzio session by bracketing the commands in a hex-1C (octal 34) and hex-1D (octal 35). Your host program or shell script simply needs to be able to display the string to the screen. Anzio will intercept the information and interpret it.

An example of this is included in the following piece of a script which simply plays a wave file and displays a message box to notify the user that he/she has encountered an error while running some script.

printf "\034receive quiet \035 "
printf "\034playsound c:\windows\msremind.wav \035"
printf "\034message Error on file grp343.dat on $HOSTNAME \035"
printf "\034receive quiet off \035"

PC file names from the host

Many host commands take arguments that may be difficult to handle directly on the UNIX and Linux operating systems (this is actually an issue with the shell or scripting language, not the operating system itself). A good example of this is handling back-slashes for PC file names within commands destined for AnzioWin from the host. A typical AnzioWin 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
# ...

In AnzioWin version 16.1 or higher you are able to replace the back-slashes with a single forward-slash and AnzioWin will handle it correctly on the PC end.

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 and other variables, such as dollar-signs, from being interpreted by the printf command. To do this, try something similar to the following:

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

For more information on assigning and using replacement variables as demonstrated in the above example, see other knowledgebase articles such as

File naming options in AnzioWin

Using Variables in AnzioWin

Available commands to pass AnzioWin

Below is a partial list of available commands that can be passed to Anzio from a host program. Note that some of these commands are not available in the Anzio Lite version. Also note that some may not be available except when your connection is serial or when it is TCP/IP.

Operator Preference Items Description Win Lite
BEEP [ON] | BEEP SLOW | BEEP OFF Tells Anzio whether to beep or not  
BEEP IDLE [ON] | BEEP IDLE OFF Beep when idle  
CURSOR [BLINK] [ON] | CURSOR [BLINK] OFF Allows non-blinking cursor  
FONT <size> | FONT LARGER | FONT SMALLER Sets screen font size  
GAUGE [ON] | GAUGE OFF Gauge line on bottom of screen  
JUMP OFF | JUMP MEDIUM | JUMP FAST Set jump scroll  
PITCH <n> Set pitch for beeps
PRINTFONT <size> Sets printer font size  
PRINTLOW [ON] | PRINTLOW OFF Sets low-level print
SCREENMODE <string> Hardware screen modes
SCREENMODE/S Report screen info to host  
STATUS [LINE] [ON] | STATUS [LINE] OFF Status line on / off
TITLE <string> Sets window title

 

Communications Parameters Description Win Lite
7E1, 8N1, ... Shortcut to set data bit, parity, stop bit
AUTO-LF [ON] | AUTO-LF OFF Auto-linefeed
BACKSPACE 8 | BACKSPACE 127 Configure backspace key
BAUD <n> Set baud rate
BREAK Send a break
CHARSET <name> Set character set translation
COMMTYPE SERIAL | COMMTYPE WINSOCK Set communications to serial or winsock  
DATA [BITS] 5 | DATA [BITS] 6 | DATA [BITS] 7 | DATA [BITS] 8 Set data bits
DELAY <n> Delay between characters
DELAY/S Reports DELAY settings
FULL [DUP] | HALF [DUP] Set duplex
IGNULL [ON] | IGNULL OFF Ignore null characters
IMOS Set host to IMOS operating system
IRQ <n> Set interrupt vector    
IRX Set host to IRX
ITX Set host to ITX
LINE [DELAY] <n> Set delay on line turnaround
PARITY EVEN | PARITY ODD | PARITY OFF Set parity
PORT <n> Set communications port
RESET Reset terminal
RMCOS Set host to RMCOS
RTS-MODE 0 | RTS-MODE 1 | RTS-MODE 2 For use with odd comm equipment    
STOP [BITS] 1 | STOP [BITS] 1.5 | STOP [BITS] 2 Set stop bits
SYNC [ON] | SYNC OFF | SYNC FAST Remove screen "snow" in old video cards    
TAB <i> <j> <k> ... Set tab handling
TERM <termtype> Set terminal emulation type
TERMNAME <name> Set term type to report to host
TTY Set host to TTY
UNIX Set host to UNIX
VRX Set host to VRX

File Transfer Description Win Lite
CAPTURE [ON] | CAPTURE LONG | CAPTURE OFF Capture data coming to screen
CLOSEI Close input file  
CLOSEI/S Close input file and report to host  
CLOSEO Close output file  
CLOSEO/S Close output file and report to host  
DELETE <filename> Delete file  
DELETE/N <filename> Delete file with no errors  
DELETE/S <filename> Delete file and report status to host  
FIND/S <filespec> Find file and report first file name to host  
FINDNEXT/S Causes ANZIO to report next file name to host  
FTPGET Get a file from the host using the ftp protocol  
FTPGET/S Get a file from the current host using the ftp protocol and return a status to the host  
FTPPUT Send a file to the host using the ftp protocol.  
FTPPUT/S Send a file to the current host using the ftp protocol and return a status to the host  
KCOMMAND <command> [<parameters>] Send kermit command  
KEEP [<x1> <x2> <y1> <y2>] Copy part of screen to file  
KEEP/N [<x1> <x2> <y1> <y2>] Copy part of screen to file w/out terminators  
KRECEIVE [<unixfilespec> [AS <filespec>]] Receive a file with kermit  
KSEND [<filespec> [AS <unixfilespec>]] Send a file with kermit  
OPENI <filename> Open an input file  
OPENI/S <filename> Open an input file and report to host  
OPENO <filename> Open an output file  
OPENO/N <filename> Open an output file even if it exists  
OPENO/S <filename> Open an output file and report to host  
PICK <x1> <x2> <y1> <y2> Pick screen columns for spreadsheet  
PURGE Clear file transfer buffer
RECEIVE CODED For special file transfers  
RECEIVE QUIET [ON] | RECEIVE QUIET OFF Don't display simple file transfers  
RETRANSMIT Retransmit last element  
TIMEOUT <n> For use with UFT  
TRANSMIT [ON] | TRANSMIT OFF Simple file upload  
ZRECEIVE <filename> Turn on Zmodem receive
ZSEND [-a] <filename> Send a file by Zmodem
XN Send next record  

Local Processing Description Win Lite
BOX <x1> <x2> <y1> <y2> Draw a box on the screen  
CALL <macro> Macro key subroutine
CD [<unit:>]<dirname> Change working directory on PC  
CHOOSEPRINT Opens printer dialog box  
CLIP [<x1> <x2> <y1> <y2>] Copy area to clipboard  
COPY <filename> <newfile> Copy a file  
COPY/S <filename> <newfile> Copy a file and report to host  
DATE Send date to host
DEFAULTS Save default settings
DEFINE <x> <text> Define a macro key  
DELETE <filename> Delete file on the PC  
DELETE/N <filename> Delete file on the PC and ignore "not found"  
DELETE/S <filename> Delete file on the PC and report to host  
DIAL <string> [<wait> [<retries>]] Dial a modem number
DIR [<pathname>] List PC directory  
DIR/S [<pathname>] List PC directory and report to host  
DROPOUT Exit from Anzio without resetting port  
EJECT Eject a printer page
END Quit
ENV/S <variable> Send DOS environment variable to host
FILL <x1> <x2> <y1> <y2> <char> Fill area of screen  
FLUSH Release a print job
FLUSHTIMER <n> Set timed release of print job
INVOKE <macro> Start a macro key
LAUNCH <program> [<parameters>] Start another program in Windows  
LOG [<unit:%gt;]<dirname> Change current working directory on PC  
MENUBAR <x1> <x2> <y1> <y2> <x3> <x4> <off> <len> [<cols>] Create an onscreen menu  
MERGE <filename> Merge in an auxiliary key file  
MESSAGE <string> Displays a message box
MKDIR <dirname> Make a PC directory  
MKDIR/S <dirname> Make a PC directory and report to host  
MODE-132 <xx> Set screen mode for 132 by 25    
PAN <n> | PAN LEFT | PAN RIGHT Move right/left in virtual screen    
PASTE Paste Windows clipboard text  
PLAYSOUND <filename> Plays a WAV file  
PRINT Print the current screen
PRINT <x1> <x2> <y1> <y2> Print all or part of screen
PRINT/N <x1> <x2> <y1> <y2> Print all or part of screen with CRLF
PRINTER <printername> Which printer to use
PRINTER-SETUP [<text>] Configure PC printer
PRINTFILE <filename> Print a PC text file
READ <filename> Read a key file
RENAME <filename> <newfile> Rename a PC file
RUN [<program> [<parameters>]] Shell out to DOS  
RUN/N [<program> [<parameters>]] Shell out to DOS with no exit keystroke  
SAVE [<filename>] Save keys file
SCROLL [ON] | SCROLL OFF Save erased data
SEND <x1> <x2> <y1> <y2> Transmit part of screen to host
SETCOLOR <n> | SETCOLOR NORMAL Reset current color
SLEEP <hh> <mm> <ss> Wait until a certain time
TIME Send time to host
TYPE <filename> Show a PC file on screen
VERSION What version of Anzio?
VERSION/S Send host the Anzio version
WAIT <n> Wait a specified time
WAITFOR <string> [<timeout>] Wait for specific text from host
WIDTH 132 | WIDTH 80 Set virtual screen size
WINDOW <x1> <x2> <y1> <y2> [FILL] [BOX | DOUBLE] Open a Window on screen  
WINDOWCLOSE Close the onscreen window  

These lists are not complete (see the manual for a complete listing). However, there is enough here to get you started. If you have questions about a specific command, email us.

Some examples

Initiating A Passthrough Print

If you are unfamiliar with how passthrough print works, we would suggest you read our short document of A Guide To Anzio Passthrough Printing before setting up scripts for this type of printing. Initiating a passthrough print job at the host end is as simple as sending the correct terminal codes (assuming that your terminfo file for the particular terminal type you are using has had the mc5 and mc4 codes defined). The script printpt.sh demonstrates this:   printpt.sh

        clear                                               
        printf "Rasmussen Software, Inc. Passthrough Print with AnzioWin\n"
        printf "  File To Print: $1 \n"         
        printf "\034receive quiet\035"                     
        tput mc5                                    
        cat $1                                         
        tput mc4                                       
        printf "\034receive quiet off\035"

For a more advanced approach, download our PassPrt script. This script takes into consideration missing TERM variables (terminal type) and when the terminal type being used does not have passthrough printing defined in the TERMCAP or TERMINFO file.

Sending Files Via A Simple Transfer

AnzioWin will allow for a simple file transfer. This method does no error checking or encoding of characters, and hence assumes that the file is normal text-only. The script getsmpl.sh and putsmpl.sh shows the file transfers in both directions:

    getsmpl.sh

        clear                                                              
        printf "Rasmussen Software, Inc. Simple ASCII Receive Thru AnzioWin \n"
        printf "  Transfer File: $1 from c:\\\temp \n"                          
        printf "\034log c:\\\temp \035 \n"
        printf "\034openi $1 \035"                                           
        printf "\034receive quiet off\035"                                   
        printf "\n "                                                           
        printf " Do Shft-Ctrl-F and enter 'transmit '  \n"                      
        printf " At the end of the transfer, press DELETE to continue.\n"     
        cat > $1                                                           
        printf "\034transmit off \035"                                       
        printf "\034closei\035"                                              

    putsmpl.sh

        clear                                                          
        printf "Rasmussen Software, Inc. Simple ASCII Send Thru AnzioWin\n"
        printf "  Transfer File: $1 into c:\\\temp \n"                      
        printf "\034log c:\\\temp \035 \n"                                  
        printf "\034receive quiet\035"                                   
        printf "\034openo/n $1 \035"                                     
        printf "\034capture\035"                                         
        cat $1                                                         
        printf "\034capture off\035"                                     
        printf "\034closeo \035" 

Transfer Files Via ZModem

File transfer via the ZModem protocol is handled similar to a simple file transfer. The scripts getzm.sh and putzm.sh show how it is done (the assumption is that sz and rz are available on your host):

    getzm.sh

        clear                                                       
        printf "Rasmussen Software, Inc. ZModem Receive thru AnzioWin\n"
        printf "     Transfer File: $1 from c:\\\temp \n"                
        printf "\034log c:\\\temp \035"                               
        printf "\034zsend -qa $1\035"                                 


    putzm.sh

        clear                                                    
        printf "Rasmussen Software, Inc. Zmodem Send Thru AnzioWin\n"
        printf "  Transfer File: $1 into c:\\\temp \n"                
        printf "\034log c:\\\temp \035"                            
        sz -a $1     

 

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