Rocket Terminal Emulator

 View Only
Expand all | Collapse all

VBA Scripting on BlueZone Emulator

  • 1.  VBA Scripting on BlueZone Emulator

    Posted 10-29-2021 07:25
    Hi All,

    I'm scripting with VBA for BlueZone and realised that WaitForString function isn't working.
    Does anyone have met the same issue and found a solution to it?

    Thanks

    ------------------------------
    Leslie Lau
    Payment Officer
    Skandinaviska Enskilda Banken AB (publ)
    Singapore Singapore
    ------------------------------


  • 2.  RE: VBA Scripting on BlueZone Emulator

    Posted 10-29-2021 17:32
    Hi Leslie,
    I am also having the same issue with Visual Studio. I can easily get excel VBA to work though. Its like the parameters change when using Visual Basic .Net.
    Where are you coding from?

    ------------------------------
    David Hatcher
    Rocket Forum Shared Account
    ------------------------------



  • 3.  RE: VBA Scripting on BlueZone Emulator

    ROCKETEER
    Posted 11-01-2021 09:22
    Leslie,

    I'd suggest you create a support case in the Customer Portal. They will most likely request a sample of your script and a VT trace to help troubleshoot.

    ------------------------------
    Mike Jones
    Rocket Internal - All Brands
    ------------------------------



  • 4.  RE: VBA Scripting on BlueZone Emulator

    ROCKETEER
    Posted 11-01-2021 09:29
    David,

    If I remember correctly there is  a property called ProcessDatacomm that needs to be set to false or 0 before using WaitForString from VS projects (not BZ/RTE VBA or BBS scripts). This stops the emulator from processing data from the host unless driven by a COM call like WaitForString, Wait(s), SendKeys, etc...

    ------------------------------
    Mike Jones
    Rocket Internal - All Brands
    ------------------------------



  • 5.  RE: VBA Scripting on BlueZone Emulator

    Posted 11-01-2021 18:43
    Edited by David Hatcher 11-05-2021 14:13
    Hi Mike. 

    This is a very basic script. It connects and presses cursor down once. Just waiting to verify it happened before proceeding.
    I've attempted to add processdatacomm.
    It throws an error as follows. 

    Exception thrown: 'System.MissingMemberException' in Microsoft.VisualBasic.dll
    An unhandled exception of type 'System.MissingMemberException' occurred in Microsoft.VisualBasic.dll
    Public member 'ProcessDataComm' on type 'IWhllObj' not found.

    Doesn't look like its part of the dll file. Any examples?



    ------------------------------
    David Hatcher
    Rocket Forum Shared Account
    ------------------------------



  • 6.  RE: VBA Scripting on BlueZone Emulator

    ROCKETEER
    Posted 11-02-2021 10:10
    As Michael mentioned earlier, WaitForString (as well as ProcessDatacomm) is for the VT/6530 emulators (.ZVT/.Z65) not for Mainframe (.ZMD).


    In this case you could use WaitCursor since you are looking for the <Esc>[22;1H sequence which moves the cursor to 22,1.

    //Timeout, Row, Column, Extrawait
    Host.WaitCursor(5, 22,1, 0)

    btw, WaitForText will only scan for visible text on the screen. The MF emulator does not support scanning the datastream in any of the methods.

    ------------------------------
    Mike Jones
    Rocket Internal - All Brands
    ------------------------------



  • 7.  RE: VBA Scripting on BlueZone Emulator

    Posted 11-02-2021 12:07
    Edited by David Hatcher 11-05-2021 14:15
    I can easily get Wait for String to work using the IDE inside of the VT or with excel. 

    When referencing BZWHLLLib in Visual Studio I don't see any mention of ProcessDatacomm in the Object Browser. 

    I've added a test for WaitCursor but it stops the script during the wait. Even if its 'True' it doesn't immediately return but waits out the time. 
    Also, we have a couple of screens that don't reveal cursor location. 

    Do you have any suggestions on getting WaitForString to work in Visual Studio? Your documentation shows VB .Net as an option.






    ------------------------------
    David Hatcher
    Rocket Forum Shared Account
    ------------------------------



  • 8.  RE: VBA Scripting on BlueZone Emulator

    ROCKETEER
    Posted 11-02-2021 12:32
    David,

    OK my example was assuming you were connecting to a 3270 session, not VT. Can you pull the version info from the bzwhll.dll? There were a lot of changes/fixes in 6.2.X versions in regards to WaitForString/ProcessDatacomm.

    BZWHLLLib.IWhllObj.ProcessDatacomm As Boolean

    Property ProcessDatacomm As Boolean
    Member of BZWHLLLib.IWhllObj

    ------------------------------
    Mike Jones
    Rocket Internal - All Brands
    ------------------------------



  • 9.  RE: VBA Scripting on BlueZone Emulator

    Posted 11-02-2021 16:20
    Edited by David Hatcher 11-02-2021 18:03
    Hi Mike. 6.2.3.2483 (Edited)
    Do you have a working version of applying ProcessDatacomm to VB .Net
    and it functioning with the data stream. 

    I have noticed even with get cursor it doesn't update the cursor position if the screen isn't clicked. 
    Manual movement shows instant cursor position changes at the bottom. But automated send keys move it but don't update the position.

    ------------------------------
    David Hatcher
    Rocket Forum Shared Account
    ------------------------------



  • 10.  RE: VBA Scripting on BlueZone Emulator

    ROCKETEER
    Posted 11-04-2021 09:59
    I had to research ProcessDatacomm, it was added to the bzwhll COM object in 7.1.5.2803, which would explain why VB.NET says it doesnt exist for you. I suggest you sign into the Customer Support portal to see about getting a newer version of BZ (now RTE), which is up to v10.1.1

    ------------------------------
    Mike Jones
    Rocket Internal - All Brands
    ------------------------------



  • 11.  RE: VBA Scripting on BlueZone Emulator

    Posted 11-05-2021 14:11
    Hey Mike. Thank you for the help. I am not sure upgrading is an option.
    Sent you two private messages. Thanks.

    ------------------------------
    David Hatcher
    Rocket Forum Shared Account
    ------------------------------



  • 12.  RE: VBA Scripting on BlueZone Emulator

    Posted 11-01-2021 15:32
    Are you using VT/6530 session? I found out the hard way that waitForString only works with VT 6530 sessions

    ------------------------------
    Michael Hlusak
    Quality Anaylist
    United States Postal Service
    Washington DC United States
    ------------------------------



  • 13.  RE: VBA Scripting on BlueZone Emulator

    Posted 11-01-2021 15:37
    If you not using VT6530, you can use waitForText 

    Sub yy()

    Set bzhao = CreateObject("BZWhll.WhllObj")
    bzhao.connect ""
    With Session

    ResultCode = bzhao.WaitForText("Description", 1, 1, 20) 'wait
    'for text for 5 seconds
    If (ResultCode <> 0) Then
    bzhao.MsgBox "Host is not responding or incorrect Host!", 0
    End If


    bzhao.Disconnect
    End With
    End Sub

    ------------------------------
    Michael Hlusak
    Quality Anaylist
    United States Postal Service
    Washington DC United States
    ------------------------------



  • 14.  RE: VBA Scripting on BlueZone Emulator

    Posted 11-16-2021 04:40
    Hi,
    Sorry all for the late reply. 

    Public System As BZEXTRLib.WhllObj
    Public Session As BZEXTRLib.Session
    
    Sub Example()
    
        Set System = CreateObject("BlueZone.System")
        Set Session = System.ActiveSession
    
        Session.Screen.WaitForString("Queue",2,25)​

    When the code reached WaitForString line, it will just hang there.

    I'm running it on VT Display, currently on Rocket TE VT v10.1.1.3993 (64-bit)

    Thanks



    ------------------------------
    Leslie Lau
    Payment Officer
    Skandinaviska Enskilda Banken AB (publ)
    Singapore SG
    ------------------------------



  • 15.  RE: VBA Scripting on BlueZone Emulator

    ROCKETEER
    Posted 12-01-2021 03:42
    Edited by Zhi Li 12-01-2021 04:07
    Hello Leslie,

    As RTE display caches the internal window handle when the script uses the Screen object,  WaitForString method would be able to work at the first call but not work in next calls (hang there) since the window handle would be created each time System object is created. We will fix this in next release. In particular, for VT session, this method of Screen object will ignore row and column parameter and use TimeoutValue property of root object as timeout that is 30 seconds by default.

    To address this, there are two choices for you at this point.

    a.don't call CreateObject method each call. Instead use one global object (only create once). But this way is not very scalable depending on your scenario, and this would not work if you rerun your application but keep VT display open due to above reason.
    b. use WaitForString method of the root object, which is the preferred wait method for VT session. Here is an example.

    Set System = CreateObject("BlueZone.System")
    System.Connect()
    System.WaitForString("Queue", 10)
    System.SendKey("done")

    Does it work?

    Thanks



    ------------------------------
    Zhi Li
    Rocket Software Inc
    ------------------------------