Grrrrr! Now it's not running at all.
' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$
Dim rc%, row%, MaxColumns%, MaxRows%, filenum%
Dim Screenbuf$, linebuf$, FileName$
Dim System As Object
Dim Session as Object
Dim sText As String
Dim iMaxRows As Integer
Dim iMaxCols As Integer
Dim i As Integer
Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object
Dim Sessions As Object
Dim System As Object
Dim Screen As Object
Dim Sess As Object
Dim MyScreen As Object
Dim MyArea As Object
Dim counter As Integer
counter = 1
label1:
Set System = CreateObject("EXTRA.System") ' Gets the system object
With System.Sessions(1).Screen
If (System is Nothing) Then
Msgbox "Could not create the EXTRA System object. Stopping macro playback."
STOP
End If
Set Sessions = System.Sessions
If (Sessions is Nothing) Then
Msgbox "Could not create the Sessions collection object. Stopping macro playback."
STOP
End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
g_HostSettleTime = 300 ' milliseconds
r_HostSettleTime = 5000 ' milliseconds
OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
' Get the necessary Session Object
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
Set Session = System.ActiveSession
If (Sess0 is Nothing) Then
Msgbox "Could not create the Session object. Stopping macro playback."
STOP
End If
If Not Sess0.Visible Then Sess0.Visible = TRUE
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
label:
' This section of code contains the recorded events
' Determine the size of the Presentation Space
MaxRows% = Session.Screen.Rows()
MaxColumns% = Session.Screen.Cols()
iMaxRows = .Rows
iMaxCols = .Cols
' Initialize variables to hold screen information
Screenbuf$ = ""
' linebuf$ = Space$ (MaxColumns%)
linebuf$ = Space$ (MaxColumns%*MaxRows%)
'--------------------------------------------------------------------------------------------------'
' This section of code contains the recorded events
Sess0.Screen.Sendkeys("<Clear>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime
Sess0.Screen.Sendkeys("axc<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
If (counter = 1) Then
Sess0.Screen.Sendkeys("rc8099914<EraseEOF><NewLine><EraseEOF><NewLine>0531201205312012<Enter>")
Sess0.Screen.Sendkeys("<NewLine><NewLine><NewLine>V<Enter>")
ElseIf (counter = 2) Then
End If
Sess0.Screen.WaitHostQuiet(r_HostSettleTime)
Sess0.Screen.Sendkeys("<Pf7>")
For i = 1 To iMaxRows
sText = sText & .getstring(i, 1, iMaxCols) & vbLf
Next
Sess0.Screen.WaitHostQuiet(r_HostSettleTime)
Sess0.Screen.Sendkeys("<Pf8>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
For i = 1 To iMaxRows
sText = sText & .getstring(i, 1, iMaxCols) & vbLf
Next
Sess0.Screen.Sendkeys("<Pf8>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
For i = 1 To iMaxRows
sText = sText & .getstring(i, 1, iMaxCols) & vbLf
Next
Sess0.Screen.Sendkeys("<Pf8>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
For i = 1 To iMaxRows
sText = sText & .getstring(i, 1, iMaxCols) & vbLf
Next
Sess0.Screen.Sendkeys("<Pf3>")
filenum% = FreeFile
FileName$ = "C:\Projects\Text fiele\OPEN REPORTS 4.txt"
Open FileName$ For Append as filenum%
Print # filenum%, sText; Chr$ (12)
Close filenum%
sText = ""
linebuf$ = Space$ (iMaxCols%)
if (counter >= 2) Then
System.TimeoutValue = OldSystemTimeout
Counter = 0
else
counter = counter + 1
goto label1
End If
End With