Rocket Terminal Emulator

 View Only

 How to create an Event that triggers a VBA macro when a string appears on the screen

Michael Hlusak's profile image
Michael Hlusak posted 01-20-2021 08:44
​​​Hello,

I previously used Attachmate Reflection 14.75.1 and I used events in vba that triggered a macro when a specific String appeared on the screen.

I cannot figure out how to do this in BlueZone.. I am using BlueZOne 7.1 (32 bit) with Visual Basics
Tommy Hueber's profile image
ROCKETEER Tommy Hueber
Hi Michael,

the "Rocket TE Advanced Automation - Developer Guide" is certainly worth taking a look at for sample code. You can find it at the Rocket Documentation Library: https://docs.rocketsoftware.com/

Provided that you're already able to find the string you want via VBA, you can subsequently run a macro (or a script). Sample code:

set bzhao = CreateObject("BZWhll.WhllObj")
bzhao.Connect
bzhao.RunMacro "SubOne"

Mike Jones's profile image
ROCKETEER Mike Jones
BlueZone v7 doesn't necessarily have the same exact Application Event trigger feature as Reflection but there could be alternatives depending upon which emulation (3270, 5250, or VT) you are using.

In Mainframe (3270) or iSeries (5250) you could define a HotSpot string that auto-plays a script that plays your vba macro (similar to what Tommy mentioned). I believe v10 has the ability to directly play a VBA macro from a HotSpot. HotSpots can be found in Options::Display, GUI tab. Click the "Customize" button.

Save the following script text as "example.bbs" in your Documents\BlueZone\Scripts folder. Then the script will be visible when defining the HotSpot.

Sub Main
  set bzo = CreateObject("BZWhll.WhllObj")
  bzo.Connect
  bzo.RunMacro("Module1.Test1")
End Sub
Jeffrey Brisel's profile image
Jeffrey Brisel
This solution works for BlueZone VT v6.2.4.2666 and hopefully forward. The Rocketsoftware team pointed me to this back when we switched from Reflection

Open the session configuration file "filename.zvt" with a text editor.
Find the [Events] block. It should be between [Edit] and [File]. Create your triggers as below:

[Events]
Count=2                 (number of events you define)
Event1_Enable=1
Event1_AfterEvent=1
Event1_Type=8
Event1_String="YourTextTriggerHere"
Event1_ActionType=8
Event1_Action="ModuleName.subroutineName"
Event1_Row=0
Event1_Column=0
Event2_Enable=1
Event2_AfterEvent=0
Event2_Type=8
Event2_String="YourTextTrigger2Here"
Event2_ActionType=8
Event2_Action="ModuleName.subroutineName2"
Event2_Row=0
Event2_Column=0
Mike Jones's profile image
ROCKETEER Mike Jones
Jeff's suggestion should work in v7 but its only available using the VT emulator.