Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Catch lines screen Extra

Status
Not open for further replies.

Jlcc15

Programmer
May 26, 2015
4
BR
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?


 
Hi,
I am writing and executing in Extra macro editor.
 
OK,

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
 
I'd fix errors before trying to RUN.

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.
 
Ok,
I liked the tips.
thank you for help.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top