Skip to main content

Scripting AnzioWin from Perl


Many of the Anzio Lite and AnzioWin features can be controlled programmatically from the host. Any host language that can output data to the screen can issue commands to Anzio in order to control various functions.

The examples below are PERL snippets, used to demonstrate how this works and how easy it is to issue commands to the PC. You can do almost anything, from starting a browser session, to viewing a graphics file, all taking advantage of the PC running under Windows and Anzio.

Other programming languages

While all of the examples below are in PERL, all of these can be done in a number of other languages, including Java, C and through most shell scripts. Check with your documentation - it is simply a matter of writing certain strings to the screen, Anzio will recognize what is a command and what goes on the screen.


All of the examples below can be found in a file called: This file is a simple PERL script that demonstrates how each of these works. By no means is this all inclusive. Additional commands exist and infinite combinations are possible, we are merely demonstrating some of the more common needs.

The following constants are used in the examples:

###### Initialize ######
$begCMD = "\034"; # Start a command for Anzio
$endCMD = "\035"; # End a command for Anzio
$cs132 = "\033[?3h"; # This may vary by term type, try
$cs80 = "\033[?3l"; # it in zoomed and not-zoomed
$ptON = "\033[5i"; # Passthrough print on
$ptOFF = "\033[4i"; # Passthrough print off
$quote = '"';
$ftphost = ""; # Must code a host, username,
$ftpuser = "username"; # and password for Anzio Lite
$ftppass = "password"; # to use MS ftp.
$TempFile = "fstemp";
$Temp = ">$TempFile";

print "$begCMD env/s ANZ_PROGRAM$endCMD"; # Get the Anzio program name
$anzioprogram = ;
chop $anzioprogram;

Using FTP and SFTP with AnzioWin

AnzioWin supports FTP and SFTP scripting internally. This module demonstrates doing an FTP transfer from the host.

sub putftp {
 # Put on the host using AnzioWin ftpput.

 if ($anzioprogram eq "ANZIOLITE") {
   # You would need to use a mixture of manual methods and host scripting
   # to do something for Anzio Lite.
 else {
   # This assumes that a username and password are set in Anzio (see the
   # "login" menu item under the Communicate menu). Always goes to
   # users default directory.
   print "$begCMD ftpput $filename $endCMD";

sub getftp {
 # Get from the host using AnzioWin ftpget.

 if ($anzioprogram eq "ANZIOLITE") {
 # See notes above on Anzio Lite
 else {
   # This assumes that a username and password are set (see the
   # "login" menu item under the Communicate menu). This assumes
   # the users default directory unless you specify otherwise in
   # the $filename.
   print "$begCMD ftpget $filename $endCMD";

Also note that if you are using Secure Shell FTP (SFTP), you can ignore the login information and replace "ftpput" and "ftpget" with "sftpput" and "sftpget" commands.

Using ZModem with Anzio

Anzio Lite and AnzioWin both support Zmodem over most protocols. Here is how you start a zmodem send or receive from the host.

sub putzm {
# Put on the host using zsend.
print "$begCMD zsend $filename $endCMD";
sub getzm {
# Get from the host using zreceive. For this
# example we assume zmodem auto receive is on.
system "sz $filename";

Using Kermit with Anzio

Anzio Lite and AnziOWin both support standard Kermit. Here is how you start a Kermit transfer from the host.
sub putkerm {
# Put on the host using ksend.
print "$begCMD ksend $filename $endCMD";

sub getkerm {
# Get from the host using kreceive. For kermit to
# work properly, kermit needs to start the kreceive. This can
# be done by embedding a separate file inside the kermit command,
# though it takes som monkeying around to get it to work through perl.
# It does not work to simply run the command in the string because
# kermit will not handle the printf - so use a separate file, i.e
# kr.bash (printf "\034kreceive as $1 replace\035 \n").
#$k1 = 'set file names literal, !kr.bash, send $filename, quit';
#system 'kermit -C $k1';
# - for this example, we assume auto-receive is on and simply do it.
system "kermit -s $filename";

Clone a new Anzio session

It is possible to have Anzio Lite or AnzioWin clone itself. From the host, you can force another session of Anzio to run.

sub clone {
# Clone a new session
print "$begCMD clone $endCMD";

Toggle the screen size between 80 and 132

Anzio supports 80 columns (standard), 132 columns or custom screen sizes. The host can force this change to take place.

sub cs132 {
# Change the screen size to 132 columns on the fly
print $cs132;

sub cs80 {
# Change the screen size to 80 columns on the fly
print $cs80;

Start a PC browser session from the host

From the host, you can tell AnzioWin to start another program, including starting the web browser. Using the "winstart", "run" or "launch" command, you can start the program associated with the file type. Anzio Lite only supports "winstart" at this time.

sub web {
# Start the web browser using filename as argument
# File name should start with 'http://'. If not you may
# want to force it in this script.
print "$begCMD winstart $filename $endCMD";

Force the user to choose a printer before printing

For special print jobs, you can have the host force the user to manually change the printer with this script. If you know the printer name, you could also force Anzio to change the printer in the background (see manual for more info on this).

sub chpr { # Force user to choose printer
print "$begCMD chooseprinter$endCMD";

Capture host output to the printer

One method of getting something to the printer from the host is via the capture command.

sub capprint {
# Turn on capture to printer, cat the file, turn off capture
print "$begCMD capture WPRN $endCMD";
system "cat $filename"; ## ###
print "$begCMD capture off $endCMD";

Print a file with passthrough print

Another method of printing from the host is to use the passthrough print capabilities of Anzio. This is similar to what most host applications will support.

sub pprint {
# Use standard passthrough print to print file
print $ptON;
system "cat $filename"; ## ###
print $ptOFF;

Transfer a file and then start it based on its file extension

With zmodem, kermit or ftp, you can automate the process of transferring a file to the PC and starting it either in a specific application or by its associated file type (extension).

sub start {
# Transfer a file to the PC and then start it
# Assume zm puts file in download dir
print "$begCMD winstart $downdir\\$filename $endCMD";

Grab information from the PC to the host

Anzio Lite and AnzioWin can tell the host a number of important facts about the PC. Things such as the PC's IP, the Windows user, the download directory, etc., can all be passed from Anzio to the host.

sub info {
# Grab and show information about the PC
print "$begCMD version/s $endCMD"; # Get Anzio version
$anzioversion = ;
print "$begCMD env/s ANZ_PROGRAM$endCMD"; # Get the Anzio program name
$anzioprogram = ;
chop $anzioprogram;

if ($anzioprogram ne "ANZIOLITE") { # Turn on quiet if available to
print "$begCMD receive quiet $endCMD"; # suppress misc displays

print "$begCMD env/s ANZ_DOWNDIR$endCMD"; # Get the download dir
$downdir = ;
chop $downdir;
print "$begCMD env/s ANZ_CURDIR$endCMD"; # Get the current directory
$curdir = ;
chop $curdir;

print "\n";
print "PC is running $anzioprogram VERSION $anzioversion\n";
print "PC Download directory: $downdir\n";
print " Current directory: $curdir\n";

print "$begCMD env/s ANZ_TITLE$endCMD"; # Get Windows title
$wintitle = ;
print " Anzio window title: $wintitle";
print "$begCMD env/s ANZ_COMPUTERNAME$endCMD";# Get PC Name
$pcname = ;
print " Computer name: $pcname";
print "$begCMD env/s ANZ_IP$endCMD"; # Get PC ip
$pcip = ;
print " IP address: $pcip";
print "$begCMD env/s ANZ_HOSTNAME$endCMD"; # Get hostname
$hostname = ;
print " Hostname logged to: $hostname";
print "$begCMD env/s ANZ_TCPNAME$endCMD"; # Get Windows TCP/IP
$pctcp = ;
print " Window TCP name: $pctcp";
print "$begCMD env/s ANZ_WINNAME$endCMD"; # Get Windows Logged User
$winname = ;
print " Window username: $winname";
print "$begCMD env/s ANZ_USERNAME$endCMD"; # Get Anzio params username
$anzname = ;
print " Anzio username: $anzname";
print "$begCMD env/s ANZ_WINDIR$endCMD"; # Get Windows Dir
$windir = ;
print " Window directory: $windir";
print "$begCMD env/s ANZ_SYSDIR$endCMD"; # Get System Dir
$sysdir = ;
print " System directory: $sysdir";
print "$begCMD env/s ANZ_LAST_LAUNCH$endCMD"; # Get last prog launched
$lastlaunch = ;
print " Last launched: $lastlaunch";
print "$begCMD env/s ANZ_LAST_RECD$endCMD"; # Get last file recvd
$lastrecv = ;
print " Last file recvd: $lastrecv";

Transfer then display an image

AnzioWin has the ability to display bitmaps at various locations on the Anzio screen, as an image or watermark. In the example below, a file is downloaded to the PC and then displayed on the Anzio screen. Tie this in with the screen scraping function and you could grab a graphics image filename from the screen and show it with the data.

sub img {
# move an image and then show it in the AnzioWin window
if ($anzioprogram eq "ANZIOWIN") {
if ($filename ne "off") {
print "$begCMD bmp $downdir\\$filename 300 100 0 0 $endCMD";

Force a print of the screen from the host

You can force the host to do a print screen with the following simple command. Also you can provide a portion of the screen with the "print c1 c2 r1 r2" parameters to print a smaller selected area.

sub pscreen {
# print the screen
print "$begCMD printer WPRN$endCMD"; # Need to force it to use
# Windows drivers
print "$begCMD print $endCMD";

Set the Anzio window title

You can change thee Window title being shown to the user. An example of this would be to set the Window title in a script to match the host application being used, such as the example below does.

sub wintitle {
# change the Anzio window title
print "$begCMD title You are using PINE $endCMD";
# set it back
print "$begCMD title AnzioWin $endCMD";

Have the host play a local sound file

Have the host play a local wave file (or you can download it then have it played).

sub sound {
# play a Windows wave file
print "$begCMD playsound c:\\windows\\media\\exclamation.wav$endCMD";

Scrape the screen

Using the keep or pick command, you can capture, or scrape, all or part of the screen into a file. You could then manipulate this file at the PC or at the host (after transferring it). Using the "send" command you can re-send to the host, a portion of the screen, or using the "clip" command, place it on the clipboard for other applications to paste in.

sub scrape {
# scrape screen to file and move to host
if ($anzioprogram eq "ANZIOLITE" ){
print "$begCMD Not available in Anzio Lite.$endCMD";
else {
if ($filename ne "") {
print "$begCMD Openo/n $downdir\\$filename $endCMD";
# could do keep with screen params to scrape only a certain
#area, i.e. keep c1 c2 r1 r2
print "$begCMD keep $endCMD";
print "$begCMD closeo $endCMD";
print "$begCMD zsend $downdir\\$filename $endCMD";
# you could now do something with the file, either at
# the host or on the PC.

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