-
On error code
Hello all. I am having a problem. I need an on error code for my macro below. The coding below is designed to find IA on screen, once it's found it should go to .FoundTextRow column 3. but if it is not found on the screen then I need it to .TransmitTerminalKey rcIBMreset key and continue. Any suggestions?
Right now, it errors out on runtime error 4132.
displayText = Session.FindText("IA", 8, 75)
.SetMousePos .FoundTextRow, 3
.TerminalMouse rcLeftClick, rcMouseRow, rcMouseCol
.TransmitANSI "x"
.TransmitTerminalKey rcIBMEnterKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.WaitForEvent rcEnterPos, "30", "0", 20, 41
.WaitForDisplayString "Action:", "30", 20, 33
.TransmitANSI "accomplete"
.TransmitTerminalKey rcIBMEnterKey
Thanks in advance.
-
Re: On error code
Welcome to the Forums.
Is this in VB 6 or something else? Are you using some control as "Session" is not a native VB 6 object. Are you automating a Terminal Emulation program or ???
-
Re: On error code
Well, it is VB 6.3 and it is for AS400 Reflections.
-
Re: On error code
-
Re: On error code
What are the return possibilities of displayText ?
Not sure if it supports Len but its a basic in VBA so it should. It will test the length of the value in the variable - displayText.
Code:
displayText = Session.FindText("IA", 8, 75)
If Len(displayText) = 0 Then
'Not found
.TransmitTerminalKey rcIBMreset
Else
.SetMousePos .FoundTextRow, 3
.TerminalMouse rcLeftClick, rcMouseRow, rcMouseCol
.TransmitANSI "x"
.TransmitTerminalKey rcIBMEnterKey
.WaitForEvent rcKbdEnabled, "30", "0", 1, 1
.WaitForEvent rcEnterPos, "30", "0", 20, 41
.WaitForDisplayString "Action:", "30", 20, 33
.TransmitANSI "accomplete"
.TransmitTerminalKey rcIBMEnterKey
End If