Catch lines screen Extra
Catch lines screen Extra
(OP)
Hi,
I want catch lines from screen Extra and put into txt file. How I can do this?
I try macros examples from Extra. But the CreateObject("EXTRA.System") method fails in windows 7.
Can someone hepl me?
I want catch lines from screen Extra and put into txt file. How I can do this?
I try macros examples from Extra. But the CreateObject("EXTRA.System") method fails in windows 7.
Can someone hepl me?
RE: Catch lines screen Extra
Where are you writing and executing your VBA code?
RE: Catch lines screen Extra
I am writing and executing in Extra macro editor.
RE: Catch lines screen Extra
RE: Catch lines screen Extra
Global g_HostSettleTime%
Sub Main()
'--------------------------------------------------------------------------------
Dim Sessions As Object
Dim System As Object
Set System = CreateObject("EXTRA.System")
If (System is Nothing) Then
Msgbox "Error macro 1."
STOP
End If
Set Sessions = System.Sessions
If (Sessions is Nothing) Then
Msgbox "Error macro 2."
STOP
End If
'--------------------------------------------------------------------------------
g_HostSettleTime = 3000
OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
If (Sess0 is Nothing) Then
Msgbox "Error macro 3."
STOP
End If
If Not Sess0.Visible Then Sess0.Visible = TRUE
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Dim MaxCols as Integer
MaxCols% = Sess0.Screen.Cols
Dim MaxRows as Integer
MaxRows% = Sess0.Screen.Rows - 3
Dim Buffer as String
Buffer$ = ""
Dim LineBuffer as String
LineBuffer$ = ""
Dim NumLin as String
NumLin = "000000"
Dim Lin as Integer
Lin% = 4
Close
FNum% = FreeFile
Open "C:\file12.txt" for Output as FNum%
Do
LineBuffer$ = Sess0.Screen.GetString (Lin%,1,MaxCols%)
If Right$(Trim$(LineBuffer$),3) = "END" and Right$(Trim$(LineBuffer$),5) <> "DOEND" Then
Buffer$ = Buffer$ + LineBuffer$
Print #FNum%, Buffer$
Exit Do
End If
If Lin% Mod 23 = 0 Then
Buffer$ = Buffer$ + LineBuffer$
Print #FNum%, Buffer$
Lin% = 4
NumLin$ = Left$(LineBuffer$,7)
Buffer$ = ""
Sess0.Screen.Sendkeys("<Pf8>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Else
If Val(Left$(LineBuffer$,7)) > Val(NumLin$) Then
Buffer$ = Buffer$ + LineBuffer$ + Chr$ (13) + Chr$ (10)
End If
Lin% = Lin% + 1
End If
Loop
Close
MsgBox "File: C:/file12.txt"
SystemY.TimeoutValue = OldSystemTimeout
End Sub
RE: Catch lines screen Extra
SystemY.TimeoutValue = .......
What is SystemY????
There may be other syntax errors.
I almost NEVERTHELESS code in Extra. In my line of work I'm scraping data from the mainfram terminal emulator, to get it into Excel for analysis. So I do nearly ALL my coding in Excel VBA. Excel has a much MUCH better code editor.
RE: Catch lines screen Extra
I liked the tips.
thank you for help.