Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scrape data from top of page

Status
Not open for further replies.

Biznez

Technical User
Apr 9, 2015
106
CA
Hello everyone, im having an issue with auto scroll up to extract date from Attachmate. So basically, when im on a payment screen, it shows the bottom of the page first and then extracts only that screen. I would like it to scrape date start from top of page and works its way down to bottom. THis is the code i have so far. Thanks in advance.

Code:
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(0)
	
    Dim fso as Object
    Dim ts as Object
    Dim i
    Dim strCBName
    Dim blnHasMoreLines
 
    'create the file system object
    Set fso = CreateObject("Scripting.FileSystemObject")
 
    'get the copybook name
    strCBName = "T328"
 
    'create the copybook file
    Set ts = fso.CreateTextFile("C:\temp\" & strCBName & ".txt", true)
    
    blnHasMoreLines = True
    
    ' record the loan information & column headers once
    ts.WriteLine Sess0.Screen.GetString(4, 2, 79)
    ts.WriteLine Sess0.Screen.GetString(5, 2, 79)
    ts.WriteLine ""
    ts.WriteLine Sess0.Screen.GetString(7, 2, 79)
    ts.WriteLine Sess0.Screen.GetString(8, 2, 79)
    ts.WriteLine ""
 
    'copy all lines on the screen except the header until there are no more lines
    While blnHasMoreLines
        'determine if there are more lines after the current screen

        blnHasMoreLines = (Sess0.Screen.Search("PAYMENT DATE").Value = "")

      
        
        For i = 10 to 21
            ts.WriteLine Sess0.Screen.GetString(i, 2, 79)
        Next i
        
        'send the next page command
	Sess0.Screen.Sendkeys("<Pf8>")	
	Sess0.Screen.WaitHostQuiet(0)
    Wend


    'close and destroy objects
    ts.Close
    Set ts = Nothing
    Set fso = Nothing

    MsgBox "Done recording " & strCBName 
    
    Sess0.Screen.WaitHostQuiet(0)

    System.TimeoutValue = OldSystemTimeout
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top