' Set the default wait timeout value
g_HostSettleTime = 20 ' 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
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)
close
'just in case you had any input/ouput files open already this will close them and you can begin afresh
Open "d:\data\dump\ORDERRESULTS.txt" for OUTPUT as 3
'THIS IS THE OUTPUT FILE THE 3 BECOMES TH IDENTIFER FOR IT.
Open "d:\data\dump\ORDIN2.txt" for input as 2
'THIS IS THE INPUT FILE AGAIN THE 2 BECOMES THIS FILES IDENTIFIER
Do while not eof (2) 'THIS MAKES THE CODE LOOP UNTIL EOF
line input #2, mystring1$ 'READ IN A LINE OF TXT AND GIVE IT A VARIBLE NAME THIS PICKS UP THE WHOLE LINE.
ORD$ = mid(mystring1$,1,8) 'TRIM IT DOWN SO THAT ONLY THE CHARACTERS NEEDED ARE PRESENT (IE NO SPACES ETC)
Sess0.Screen.putstring ord$,1,9 'output to the session
Sess0.Screen.Sendkeys("<enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
COPYAREA = sess0.screen.area(05,47,05,55)' select a section of the screen and allocate to a varible
Print #3, ORD$ + "," + COPYAREA 'now ouput to our specified file with a comma between my input & ouput data (easier for conversions later ie csv)
loop 'jump back to the top and do it all again.
End Sub