[ List Archives Home ] [ Thread index for 2008 ] [ Date index for 2008 ] [ Author index for 2008 ]


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A recent comment about telnet programs with macro recording capabilities
prompts me to write.

At the last IUG meeting there was presented (twice) a session about using
macros to automate certain tasks in Innopac. The presenters did a fine job
of explaining the usefulness of that idea, and examples. The presentation
may be available on the innopacusers.org site; I don't know, I don't have
access (sigh). They did their demonstration using a telnet package other
than Anzio (which is fine by me), but they stated that AnzioWin did not
have macro capabilities, an error which I am trying to correct. I'd also
like to enhance the topic a bit.

Note that macros are practical and common in telnet programs, which deal
with character-based host programs. They are difficult to do in graphical
(GUI) programs, at least as add-on programs.

It reminds me of the lyric "everything old is new again." Macros have
been a feature of AnzioWin, and before that Anzio for DOS, for about 15
years. More recently we added a recording capability, which makes it much
easier to create macros. During and following the conference, I took
another look at where we were with AnzioWin. I discovered some bugs
(there, I admit it!) and fixed them.

A macro is a sequence of operations, like a "script" or a small program.
In a telnet program, it is usually concerned with sending characters to
the host system (at the correct time). It might also change the telnet
program's configuration settings, such as for printing, or do local
operations on the PC, such as copying files. A macro can be launched at
program startup, or it can be initiated by the user, typically by pressing
a special key that is associated with the macro.

A macro recording feature provides a simple way to create a macro.
Typically, you turn on Record mode, and as you type characters to the
host, they are recorded into the macro. When you turn off Record, you can
then save the macro. AnzioWin and many other telnet programs offer this.

That, however, is the simplest example of a macro -- one in which a
character sequence is sent to the host. Following are some more involved
situations.

1) The data you send may need to change. For instance, at one point in the
macro you may want to send a branch number to Innopac, and you need to
enter a different branch number each time. We call this "pause for
operator input" (catchy!). In AnzioWin, this is represented by a "#" in
the macro sequence (this brevity shows Anzio's age). When executing, the
macro will pause, the operator will type the necessary text, and when the
operator hits <enter> the macro will continue executing. This was
demonstrated in the talk.

Let's assume you are recording a macro that contains a branch number, as
above.  While recording, enter the first branch number at the
appropriate time. After you have recorded your macro, go back in to Macro
Edit and replace the branch number with a "#", on a line by itself.

2) You may need to prevent the macro from sending the data too early. That
is, the macro may need to wait for certain information to appear on the
screen before sending the next sequence of characters. For this we have a
WAITFOR command. After recording a macro, go in to Macro Edit. At the
appropriate place, enter a WAITFOR command that specifies what should
appear immediately prior. For instance:
   WAITFOR "Branch number"
(case is not important). When the macro is executing, Anzio will wait
until the indicated text appears, and then the macro will continue.

3) What if that doesn't happen? First, you can add another parameter to
the command:
   WAITFOR "Branch number" 5
The "5" represents 5 seconds. If 5 seconds elapses without Anzio seeing
"Branch number", it will go ahead anyway. Of course, this could be
dangerous. This leads us to...

4) Error handling. What if something goes wrong? You might want to change
behavior, possibly aborting the macro. For this, Anzio provides the
ONERROR macro. You define an error-handling macro (say, macro "e"), and
put it into play by doing the command
   ONERROR e
(possibly in the original macro). Now, whenever a macro error occurs, the
original error will be terminated, and the onerror macro will execute.

The Anzio manual and the readme file identify what conditions constitute
errors and trigger an onerror macro. One such situation is the timeout of
a WAITFOR. So in the example above, if 5 seconds elapses without Anzio
seeing "Branch number", and an onerror macro is in effect, then the
original macro will terminate and the onerror macro will execute. You
could program this macro to notify the user of the problem with a MESSAGE
command, for instance. This brings us to...

5) Commands. There is a library of over 300 commands available in Anzio.
These commands let you launch and interact with other Windows programs,
change Anzio configuration settings, do file transfers, send faxes, print
files, interact with the Windows clipboard, play audio and video files,
and more. See the Anzio manual for information.

If you have ideas about enhancing these functions, of course I'd like to
hear from you.

Regards,
....Bob Rasmussen,   President,   Rasmussen Software, Inc.

personal e-mail: ras@xxxxxxxxxx
 company e-mail: rsi@xxxxxxxxxx
          voice: (US) 503-624-0360 (9:00-6:00 Pacific Time)
            fax: (US) 503-624-0760
            web: http://www.anzio.com