×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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!
  • Students Click Here

*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

Jobs

macro to print host file (in extra attachmate) to word document

macro to print host file (in extra attachmate) to word document

macro to print host file (in extra attachmate) to word document

(OP)
Hi,

Does anyone have a macro to print host file to word document?

Thanks and Best Regards,
Jonathan

( i tried the macro below, but it is not compiling successfully)

Global g_HostSettleTime%

Sub Main()

'--------------------------------------------------------------------------------
' Get the main system object
 Dim Sessions As Object
 Dim System As Object
 Set System = CreateObject("EXTRA.System") ' Gets the system object
 If (System is Nothing) Then
  Msgbox "Could not create the EXTRA System object.  Stopping macro playback."
  STOP
 End If
 Set Sessions = System.Sessions

 If (Sessions is Nothing) Then
  Msgbox "Could not create the Sessions collection object.  Stopping macro playback."
  STOP
 End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
 g_HostSettleTime = 1500  ' 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)
 
' This section will check if the screen is locked and ask for a password

        szString = Sess0.Screen.GetString(8,26,15)

        Dim MyArea As Object, MyArea2 As Object

' Check if the USER made a selection
        szString = Sess0.Screen.Selection
        szString = Trim(szString)
        If (szString <> "") Then
            GoTo Transfer:
        End If
        
        Sess0.Screen.MoveTo 1, 1
        Set MyArea = Sess0.Screen.Search("Command ===>")
        If (MyArea.Top = -1) Then
            msgbox("Could not find Command ===>")
            exit sub
        End If

        Sess0.Screen.MoveTo MyArea.Bottom - 1, MyArea.Left
        
        szString = Sess0.Screen.GetString(Sess0.Screen.Row,Sess0.Screen.Col,10)
        szString = Trim(szString)
       
        Select Case szString
        Case "SDSF BROWS"
            msgbox("This script does not support SDSF BROWSE, yet.")
            exit sub
        Case "SDSF EDIT"
            msgbox("This script does not support SDSF EDIT, yet.")
            exit sub
        Case "BROWSE"
            spos = 10
        Case "EDIT"
            spos = 11
        Case "VIEW"
            spos = 11
        Case Else
            leftString = Left(szString,4)
            If (leftString = "EDIT") Then
                spos = 09
            Else
                msgbox("This script does not support this screen.")
                exit sub
            End If
        End Select

        Sess0.Screen.MoveTo Sess0.Screen.Row, Sess0.Screen.Col   spos
        Set MyArea = Sess0.Screen.Search(" ",Sess0.Screen.Row,Sess0.Screen.Col)
        If (MyArea.Top = -1) Then
            msgbox("Could not find the end of the filename")
            exit sub
        End If

        szString = Sess0.Screen.GetString(Sess0.Screen.Row,Sess0.Screen.Col,MyArea.Left - Sess0.Screen.Col)
        szString = Trim(szString)

        pcfString = "c:\text.txt"
                
Transfer:
 Sess0.Screen.Sendkeys("<Home><EraseEOF>tsocmd<Enter>")
 Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
 
 Sess0.FileTransferScheme = "Text Default"
 Sess0.FileTransferScheme = "C:\Program Files\E!PC\schemes\Text Default.eis"
 Sess0.FileTransferHostOS = 1  
 Recv = Sess0.ReceiveFile(pcfString,"'"   szString   "'")
        If Recv Then
            hWndCalc% = Shell("C:\Program Files\Microsoft Office 2003\OFFICE11\WINWORD.EXE "   pcfString, 1)
        Else
            MsgBox ("Transfer failure. Check that you don't have "   pcfString   " open in another application. If that is not the case close and reopen extra")
        End If

 Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
 Sess0.Screen.Sendkeys("end<Enter>")

 System.TimeoutValue = OldSystemTimeout
End Sub
 

RE: macro to print host file (in extra attachmate) to word document

What i can see from your compiling issues is that.

Recv = Sess0.ReceiveFile(pcfString,"'"   szString   "'")
=
Recv = Sess0.ReceiveFile(pcfString,"'" + szString + "'")

Sess0.Screen.MoveTo Sess0.Screen.Row, Sess0.Screen.Col   spos
=
Sess0.Screen.MoveTo Sess0.Screen.Row, Sess0.Screen.Col + spos

MsgBox ("Transfer failure. Check that you don't have "   pcfString   " open in another application. If that is not the case close and reopen extra")
=
MsgBox ("Transfer failure. Check that you don't have " + pcfString + " open in another application. If that is not the case close and reopen extra")

hWndCalc% = Shell("C:\Program Files\Microsoft Office 2003\OFFICE11\WINWORD.EXE "   pcfString, 1)
=
hWndCalc% = Shell("C:\Program Files\Microsoft Office 2003\OFFICE11\WINWORD.EXE " + pcfString, 1)

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