This article is part of the Automation and Scripting - Did you know series
Automate common workflows in BlueZone using scripting languages
Did you know BlueZone comes bundled with a propriety Terminal Emulator Scripting Language, and that it also supports many other languages? Being able to automate terminal session navigation with scripts will allow you to be more productive, and multi-language support makes it easy for anyone to do. The use cases are endless: simply automate keystrokes, tedious and cumbersome processes, and avoid human error and speed up processing at the same time.
Basics of using BlueZone Script Host and Debugger
To create and play scripts - BlueZone provides a script host application, conveniently named "BlueZone Script Host and Debugger". Open your Windows BlueZone Start Menu and simply click BlueZone Scripting Host.
The application is similar to Windows Script Host, but is enhanced to include a text editor, debugger tools and support for additional languages.
The default language is BlueZone Basic, but you can select from several languages via the Options menu. Any ActiveX scripting engine can be hosted, such as JavaScript, Perl, Python, Rexx, Tcl/Tk and VBScript.
The debugger tools include setting break points, stepping code and functions, variable viewing and evaluating expressions. In short, pretty much everything you'd expect from a development's IDE debugging functionality.
From within the BlueZone Scripting Host you can start to create new or adjust existing scripts.
Automation Objects
BlueZone also includes COM objects to automate sessions and to exchange data to and from host systems. These objects can be invoked within BlueZone Script Host scripts, from custom programs such as C# and VB.Net, or from other 3rd party integrated development environments, such as Microsoft Office Excel and Access VBA macros.
The BlueZone objects API is simple and intuitive, for example, to launch a new BlueZone session, logon to a host system, and read text from the terminal:
Sub Main
set bzo = CreateObject("BZWhll.WhllObj")
SessName = bzo.NewSession("myProfile.zmd")
bzo.Connect SessName
bzo.SendKey "logon username<Enter>"
bzo.WaitReady 10, 0
bzo.TypePassword
bzo.SendKey "<Enter>"
bzo.WaitReady 10, 0
bzo.ReadScreen myData, Length, Row, Column
MsgBox myData
End Sub
If you need more information there's a good chance, you'll find it in the bundled documentation.
Using the BlueZone Script Host main menu, select "Help - BlueZone Help Topics" to display the BlueZone Advanced Automation Guide. Chapters in the documentation include:
- BlueZone Script Host and Debugger
- BlueZone Host Automation Objects
- BlueZone Basic Language
- BlueZone Plus VBA
BlueZone Plus VBA
BlueZone provides an optional add-on BlueZone VBA installable software package. When BlueZone VBA is installed, a Macros menu item is added to the session's main menu and provides access to the Microsoft VBA integrated development environment within BlueZone. This is the same Microsoft IDE used in Excel and Access Office macros.
The BlueZone automation COM objects are "built-in" when using BlueZone VBA, and accessible using the global Session variable. All BlueZone VBA modules, classes and forms are stored in BlueZone VBA project(.BVP) files in the BlueZone\Macros folder.
Happy scripting and please considering sharing what tasks you've been able to automate with forum members.
------------------------------
Tommy Hueber
Rocket Software
------------------------------