Sign in to follow this  
Followers 0
HenryA

Save a Web Page to Text File

7 posts in this topic

I wish to save a Web Page to a Text file.

I think I can use _INetGetSource since I have the URL but which function will take the output of _INetGetSource and store it in a Text File?

Thank You

HenryA

Share this post


Link to post
Share on other sites



InetGetSource does a very good job at that, actually. Just dump it into a $variable and then FileWrite() it and you've got the source.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

I wish to save a Web Page to a Text file.

I think I can use _INetGetSource since I have the URL but which function will take the output of _INetGetSource and store it in a Text File?

Thank You

HenryA

If you use the IE.au3 UDF then you will be able to get it with

_IEBodyReadText

The IE.au3 functions can be found in the User Defined Functions area of the help file.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Even better. Use the IE.au3 functions. Makes web manipulation a snore.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Even better. Use the IE.au3 functions. Makes web manipulation a snore.

Thank you for your help. I am almost there. This is the program I have. The PDF file that is saved ("test.pdf") looks good but is not quite right.

Any ideas?

Thank you

=============================

#include <INet.au3>

$file = FileOpen("test.pdf", 1)

; Check if file opened for writing OK

If $file = -1 Then

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

Exit

EndIf

FileWrite($file, _INetGetSource ( 'www.w3.org/TR/2000/REC-xml-20001006.pdf' ))

FileClose($file)

=============================

Share this post


Link to post
Share on other sites

Since what you desire is a file instead of webpage source, you need this:

InetGet("http://www.w3.org/TR/2000/REC-xml-20001006.pdf", "C:\foo.pdf")

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Since what you desire is a file instead of webpage source, you need this:

InetGet("http://www.w3.org/TR/2000/REC-xml-20001006.pdf", "C:\foo.pdf")

Dale

Dale,

Thank you very much. You solved my problem 100%

Everything works fine now.

Many thanks,

HenryA

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