Sign in to follow this  
Followers 0
bobheart

Grab Html Page

12 posts in this topic

can you use au3 to grab text off of a webpage ?

and how ?

Share this post


Link to post
Share on other sites



can this be changed to do text?

;Working on my W2000 computer with Active desktop disabled.

$title = "Display Properties"

$wallpaper = "winnt";<------- Put here the filename you want after you copied the .bmp file it in @windir. (or set it "(none)")

Run(@comspec & " /c " & @Windowsdir & "\system32\desk.cpl","",@sw_hide)

WinWait($title)

ControlFocus($title, "", "ListBox2")

ControlSend($title, "", "ListBox2",$wallpaper)

ControlClick($title, "", "Button7"); Ok button

Share this post


Link to post
Share on other sites

can this be changed to do text?

Displaying literally this? :D

Extract every line with another script. (FileRead() function...maybe)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I tried www.google.com and got

$file = FileOpen("http://www.google.com/", 0)

; Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; Read in 1 character at a time until the EOF is reached

While 1

$chars = FileRead($file, 1)

If @error = -1 Then ExitLoop

MsgBox(0, "Char read:", $chars)

Wend

FileClose($file)

---------------------------

Error

---------------------------

Unable to open file.

---------------------------

OK

---------------------------

So what do id do ?

Edited by bobheart

Share this post


Link to post
Share on other sites

look up URLDownloadToFile ()

it saves the web page as a text document, from there you can read it.


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Well it saved it as html page and looks just like the page too , wow this cool .

I was trying learn how to input the url with out hard coding it in the au3 but didn't see anything or how to do it ? is there a way to have a inpy msg box to add a url to download ?

How would you use a input box like this to what url you want to grab ?

$answer = InputBox("Question", "What URL ", "add url here", "", -1, -1, 0, 0)

Edited by bobheart

Share this post


Link to post
Share on other sites

If you just want the text (like a screenscraper), you can also just copy it to clipboard if u have the page in the browser already:

  • Send "Select All" to the browser. In MSIE, you send Ctrl-A
  • Then copy to clipboard: send Ctrl-C
  • Now you can process the clipboard with ClipGet
Hope this helps :D

Share this post


Link to post
Share on other sites

No what I have now works great and grabs the page like I ant , I want to be able to input the link into a msg box and not hard code it in .

Share this post


Link to post
Share on other sites

$answer = InputBox("Question", "What URL ", "add url here", "", -1, -1, 0, 0)
URLDownloadToFile ($answer,"c:\temphtml.html")


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Aye Larry, I was just trying to keep it simple.

On a side note, not all urls will download with this function, as it looks for an exact page.

You might just want to open up an explorer window, and do the control+A Control+c and paste it into a file or msgbox. Or just wait til loaded and use the savepageas

send("!fa")


AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Thank you this works fine for what I want to do .. thank you for your help guys and gals ..

:D

Share this post


Link to post
Share on other sites

Thank you this works fine for what I want to do .. thank you for your help guys and gals ..

:D

I'm glad to hear that you're happy

You can ask anything you want and we'll try to help you.

Share this post


Link to post
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
Sign in to follow this  
Followers 0