Here's my code:
I added a Do Loop that works just fine when I step through, but when I run it, it only executes labelB: I can't figure out how to slow it down enough to process properly at its run speed.
' Determine the size of the Presentation Space
MaxRows% = Session.Screen.Rows()
MaxColumns% = Session.Screen.Cols()
' Initialize variables to hold screen information
Screenbuf$ = ""
linebuf$ = Space$ (MaxColumns%)
'--------------------------------------------------------------------------------------------------'
Do Until Field2 <> "T"
MyString$ = MyScreen.GetString(6, 52, 1)
Field2 = MyString$
Sess0.Screen.Sendkeys("<Clear>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("idsr<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("4")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
MyString$ = MyScreen.GetString(6, 52, 1)
Field2 = MyString$
if (counter = 1) Then
Sess0.Screen.Sendkeys ("1<NewLine>VDA0682800<EraseEOF><Enter>")
ElseIf (counter = 2) Then
Sess0.Screen.Sendkeys ("1<NewLine>VDA0682872<EraseEOF><Enter>")
ElseIf (counter = 3) Then
Sess0.Screen.Sendkeys ("1<NewLine>VDA0682810<EraseEOF><Enter>")
ElseIf (counter = 4) Then
Sess0.Screen.Sendkeys ("1<NewLine>VDA0682872<EraseEOF><Enter>")
End If
MyString$ = MyScreen.GetString(6, 52, 1)
Field2 = MyString$
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Pf8>")
'---------------------------------------------------------------------------------------------'
MyString$ = MyScreen.GetString(6, 52, 1)
Field2 = MyString$
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Pf7>")
' MyString$ = MyScreen.GetString(6, 52, 1)
' Field2 = MyString$
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Pf8>")
Loop
' MyString$ = MyScreen.GetString(6, 52, 1)
' Field2 = MyString$
If Field2 = "2" then
goto labelA
else
goto labelB
end if
' MyString$ = MyScreen.GetString(6, 52, 1)
' Field2 = MyString$
labelA:
Do Until Field2 = "T"
Sess0.Screen.Sendkeys("<Pf7>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
For row% = 1 to MaxRows%
linebuf$ = Session.Screen.Area(row%, 1, row%, MaxColumns%, , xBlock)
screenbuf$ = screenbuf$ + linebuf$ + Chr$ (13) + Chr$ (10)
Next
Sess0.Screen.Sendkeys("<Pf8>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
For row% = 1 to MaxRows%
linebuf$ = Session.Screen.Area(row%, 1, row%, MaxColumns%, , xBlock)
screenbuf$ = screenbuf$ + linebuf$ + Chr$ (13) + Chr$ (10)
Next
filenum% = FreeFile
FileName$ = "H:\TextFiles\whatsinthtfld2.txt" Open FileName$ For Append as filenum%
Print # filenum%, screenbuf$; Chr$ (12)
Close filenum%
Screenbuf$ = ""
linebuf$ = Space$ (MaxColumns%)
Field2 = "T"
goto label2
Loop
labelB:
If Field2 = "2" then
goto labelA
else
end if
Do Until Field2 = "T"
For row% = 1 to MaxRows%
linebuf$ = Session.Screen.Area(row%, 1, row%, MaxColumns%, , xBlock)
screenbuf$ = screenbuf$ + linebuf$ + Chr$ (13) + Chr$ (10)
Next
filenum% = FreeFile
FileName$ = "H:\Testing\Text Files\whatsinthtfld2.txt" Open FileName$ For Append as filenum%
Print # filenum%, screenbuf$; Chr$ (12)
Close filenum%
Screenbuf$ = ""
linebuf$ = Space$ (MaxColumns%)
Field2 = "T"
goto label2
Loop
label2:
if (counter >= 4) Then
System.TimeoutValue = OldSystemTimeout
counter = 0
else
counter = counter + 1
goto label1
End If
End Sub