Jump to content

Seeing and grabbing text from a website


Dubz
 Share

Recommended Posts

Hey, thanks in advance for any help you can provide. This is what I want to end up with:

The script will be run as a scheduled task at 3am. It will open a shortcut to a website, login with my username/pass, browse several sections, copy a portion of text and export it to Excel, save, then close the browser and excel.

Now my problem:

I can't figure out to have it read the contents of the browser. For example; when I go to the site http://www.autoitscript.com, how would I make the script see the following:

Welcome to the AutoIt Script home page

Once it sees the right page, how would I get the script to copy only that portion of text?
Link to comment
Share on other sites

Hey, thanks in advance for any help you can provide. This is what I want to end up with:

The script will be run as a scheduled task at 3am. It will open a shortcut to a website, login with my username/pass, browse several sections, copy a portion of text and export it to Excel, save, then close the browser and excel.

Now my problem:

I can't figure out to have it read the contents of the browser. For example; when I go to the site http://www.autoitscript.com, how would I make the script see the following: Once it sees the right page, how would I get the script to copy only that portion of text?

Welcome to the forums

there is a great Tutor program that has demonstrations... including IE.au3 uses for the internet

http://www.autoitscript.com/forum/index.php?showtopic=21048#

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

That's a great link :o Thank you. I'm stuck on how to use this function now:

ConsoleWrite()

I've searched google and read and tested this several times. It seems to do nothing. I'd like to see the information it is writing, but don't know how.

*Just saw the 2nd reply. I'm checking that out right now :geek: Thank you again.

Edited by Dubz
Link to comment
Share on other sites

#include <GUIConstants.au3>

GUICreate("My GUI color text"); will create a dialog box that when displayed is centered


$Button_1 = GUICtrlCreateButton("Button1", 130, 150, 170, 40, $BS_BOTTOM + $BS_CENTER)

$Label_1 = GUICtrlCreateLabel("Label1", 180, 100, 40, 170, $SS_SUNKEN + $SS_CENTER )


GUISetState()
_MouseOver($Button_1)

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $Button_1
            ConsoleWrite("Selected Button 1" & @LF)
        Case $msg = $Label_1
            ConsoleWrite("Selected Label 1" & @LF)
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

Func _MouseOver($h_controlID)
    Dim $opt = Opt("MouseCoordMode",2)
    Dim $pos = ControlGetPos ( "My GUI color text", "", $h_controlID )
    MouseMove($pos[0] + 5, $pos[1] + 5,0)
    Opt("MouseCoordMode",$opt)
EndFunc

example

8)

NEWHeader1.png

Link to comment
Share on other sites

  • 4 weeks later...

are you using SciTe editor??

8)

I'm using SciTe now, still it shows nothing when I write to console. I've run your example code aswell. It displays a GUI with a label and a button. I don't understand the relevance.
Link to comment
Share on other sites

I'm using SciTe now, still it shows nothing when I write to console. I've run your example code aswell. It displays a GUI with a label and a button. I don't understand the relevance.

Whenever I want to read webpages.. this is what i usually do:

#include <File.au3>
$Download = InetGet ( "http://www.webpage.com", "destinationpage.html" )
If $Download = 0 Then Exit

Dim $Lines
_FileReadToArray("destinationpage.html", $Lines)

For $x = 1 To $Lines[0]
    ToolTip("Reading #" & $x & " out of " & $Lines[0] & " lines", 0, 0)
    $read = StringAddCR($Lines[$x])
    If StringInStr ( $read, "WhatYouWantToFind") Then
        $read = StringStripWS( $read, 3 ); Munge the string around till you get what you need using stringsplit, etc.
        
        FileWriteLine ( "OldPdfs.txt", $read & "," & $read2 )
    EndIf
Next
Edited by exodius
Link to comment
Share on other sites

I'm using SciTe now, still it shows nothing when I write to console. I've run your example code aswell. It displays a GUI with a label and a button. I don't understand the relevance.

just click the label or the button ... and presto... it writes to the console ( just like you asked about)

8)

NEWHeader1.png

Link to comment
Share on other sites

  • 2 weeks later...

See that's the thing, it writes to the console, but then how do I see what is written, or call info from the console to have it written somewhere else?

This is what I'm trying to use right now:

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://www.inselkampf.co.uk")
$oDoc = _IEDocumentGetObj($oIE)

$forms = _IEFormGetCollection($oDoc)
For $form in $forms
    ConsoleWrite("Form name: " & $form.name & @CR)
    $fes = _IEFormElementGetCollection($form)
    For $fe in $fes
        ConsoleWrite(@Tab & $fe.name & @TAB & "Type: " & $fe.type & @CR)
    Next
Next
Edited by Dubz
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...