' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$
Sub Main()
'--------------------------------------------------------------------------------
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 = 10 ' 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 of code contains the recorded events
System.TimeoutValue = OldSystemTimeout
'Extra Object
Dim Sys_Obj As Object, Sess_Obj As Object, oScreen_Obj As Object
Set oScreen_Obj = Sess0.Screen
'Excel Object
Dim Excel_Obj As Object, Excel_Sheet As Object
Set Excel_Obj = GetObject(, "excel.application")
Set Excel_Sheet = Excel_Obj.Workbooks("your file name.xls").Worksheets(1)
Dim Extra_Col As Integer
Dim Extra_Row As Integer
Dim Extra_Page As Integer
Dim Excel_Row As Integer
Dim Excel_Col As Integer
Dim result As String
LastExcelRow = Excel_Sheet.Cells(Cells.Rows.Count, 1).End(xlUp).Offset(1).Row
For Excel_Row = InputBox("Input Starting Row") To LastExcelRow
oScreen_Obj.SendKeys ("<Home><EraseEOF>")
oScreen_Obj.SendKeys ("dcs")
oScreen_Obj.MoveTo 1, 9
oScreen_Obj.PutString Excel_Sheet.Cells(Excel_Row, 1).Value
oScreen_Obj.SendKeys ("<enter>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
oScreen_Obj.SendKeys ("dcrd")
oScreen_Obj.SendKeys ("<enter>")
oScreen_Obj.WaitHostQuiet (g_HostSettleTime)
'Check for "Request Completed" (for multiple pages) outputting each page to file
'First page
Set SearchComplete = Sess0.Screen.Search("REQUEST COMPLETED")
If SearchComplete = "" Then
Set MyArea = Sess0.Screen.Area(23, 2, 22, 11, , 10)
Else
Set MyArea = Sess0.Screen.Area(23, 2, SearchComplete.Bottom, 10)
End If
'While loop for subsequent pages
Capturing SearchComplete"
While SearchComplete = ""
Set SearchComplete = Sess0.Screen.Search("*****")
If SearchComplete = "" Then
Set SearchComplete = Sess0.Screen.Search("PROD TOTAL")
If SearchComplete = "" Then
Sess0.Screen.SendKeys ("<PF8>")
oScreen_Obj.WaitHostQuiet (g_HostSettleTime)
End If
End If
Wend
' This will search the entire page for the '****' code
Sess0.Screen.GetString(CurrentRow, CurrentCol, 6) + "
Set MyScreen = Sess0.Screen
Set MyArea = MyScreen.Search("****")
MyScreen.MoveTo MyArea.Bottom, MyArea.Left + 0
CurrentRow = MyScreen.Row
CurrentCol = MyScreen.Col
result = Trim(Sess0.Screen.GetString(CurrentRow, CurrentCol, 6))
'MsgBox "Found 'B' Code at " + Str$(CurrentRow) + "," + Str$(CurrentCol) + ", " + Sess0.Screen.GetString(CurrentRow, CurrentCol, 6) + "."
'You should be on Extra Screen for column one of start row of Excel, now I'll write something to Excel column 2 on the same row.
Excel_Sheet.Cells(Excel_Row, 2).Value = result
oScreen_Obj.WaitHostQuiet (g_HostSettleTime)
System.TimeoutValue = OldSystemTimeout
Next Excel_Row
End Sub
...................................................
I myself found this in the forum, but have managed to get it to do various screen capturing processes with great sucess.....