×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Catch lines screen Extra

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?


RE: Catch lines screen Extra

Hi,

Where are you writing and executing your VBA code?

RE: Catch lines screen Extra

(OP)
Hi,
I am writing and executing in Extra macro editor.

RE: Catch lines screen Extra

Please post your code.

RE: Catch lines screen Extra

(OP)
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

RE: Catch lines screen Extra

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.

RE: Catch lines screen Extra

(OP)
Ok,
I liked the tips.
thank you for help.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close