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
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