×
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

Help to catch lines from Extra.

Help to catch lines from Extra.

Help to catch lines from Extra.

(OP)
Hi,

I,m tried to catch lines from Extra screen.
This code doesn´t work. The system crash at Set System = CreateObject("EXTRA.System").
Windows 7.
Can someone help me?

This is my code:

' Declarações de variáveis globais
Global g_HostSettleTime%

Sub Main()
'--------------------------------------------------------------------------------
' Obtém o objeto principal do sistema.
Dim Sessions As Object
Dim System As Object
Set System = CreateObject("EXTRA.System") ' Obtém o objeto do sistema.
If (System is Nothing) Then
Msgbox "Não foi possível criar o objeto EXTRA System. Anulando a reprodução da macro."
STOP
End If
Set Sessions = System.Sessions

If (Sessions is Nothing) Then
Msgbox "Não foi possível criar o objeto de coleção Sessions. Anulando a reprodução da macro."
STOP
End If
'--------------------------------------------------------------------------------
' Define o valor do tempo de espera padrão.
g_HostSettleTime = 3000 ' milissegundos

OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If

' Obtém o objeto Session necessário.
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
If (Sess0 is Nothing) Then
Msgbox "Não foi possível criar o objeto Session. Anulando a reprodução da macro."
STOP
End If
If Not Sess0.Visible Then Sess0.Visible = TRUE
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

' Essa seção de código contém os eventos registrados

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:\teste.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 "Arquivo disponível em: C:/teste.txt"

System.TimeoutValue = OldSystemTimeout
End Sub



RE: Help to catch lines from Extra.

do you have Extra installed? your code looks good.

RE: Help to catch lines from Extra.

(OP)
Hi,
Yes. I have Extra 6.3.

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