Sign in to follow this  
Followers 0
LAMBERT99

Writing files

7 posts in this topic

This is my second script slightly modified from the examples ....

it works but it does not write the result in my script directory . (testt.txt)

#include <IE.au3>

Local $file = FileOpen(@ScriptDir &"testt.txt", 1)
; Check if file opened for writing OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

Local $oIE = _IECreate("http://cnn.com")

Local $oLinks = _IELinkGetCollection($oIE)
Local $iNumLinks = @extended
MsgBox(0, "Link Info", $iNumLinks & " links found")
For $oLink In $oLinks
;MsgBox(0, "Link Info", $oLink.href)
FileWrite(@ScriptDir &$file, $oLink.href & @CRLF)
Next
FileClose($file)

where i am doing misttake ???

Share this post


Link to post
Share on other sites



Sorry ! the problem was not the script !

i saved the script somewhere else ..... the problem of a NEWBIE ... ;)

I have one question .... what about saving a web page with other name ??

is " _IEBodyWriteHTML " that works ??? having trouble with that ...... thanks !

Share this post


Link to post
Share on other sites

Lambert99,

See inetget or inetread to save WEB pages

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

Lambert99,

This is one way to do it. See the parms for a complete explanation.

$url = 'http://www.cnn.com'
$out_file = "c:tmpmy_out_file.txt"
getter($url,$out_file)
Func getter($in, $out)
 Local $s = InetGetSize($in, 1)
 Local $g = InetGet($in, $out, 1,1)
 Do
 Until InetGetInfo($g, 2)
 if InetGetInfo($g, 4) > 0 then MsgBox(0,'*** Error downloading ',$in)
 InetClose($g)
EndFunc   ;==>getter

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

Trying to save webpages by the following code ....... no sucess ! ??????

#include <Inet.au3>
#include <IE.au3>
Local $oIE = _INetGetSource('http://www.cnn.com')
Local $sHTML = _IEDocReadHTML($oIE)
MsgBox(0, "Document Source", $sHTML)

Try this:

#include <Inet.au3>
Local $oIE = _INetGetSource('http://www.cnn.com')
MsgBox(0, "Document Source", $oIE)

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

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