phew Posted October 27, 2007 Posted October 27, 2007 (edited) hi, i wrote a little google script: (...) Func _google() For $i = 0 To 4 Step 1 If (GUICtrlRead($cb_logfile) = 1) Then FileOpen("logfile.log", 1) ElseIf (GUICtrlRead($cb_results) = 1) Then FileOpen("results.txt", 1) EndIf $page = "/search?q=" & $search & "&hl=de&start=" & $i & "0&sa=N" $start = 1 TCPStartup() $socket = TCPConnect(TCPNameToIP('www.google.de'), 80) $command = "GET " & $page & " HTTP/1.1" & @CRLF $command &= "Host: " & $host & @CRLF $command &= "User-Agent: " & "phew/rfi" & @CRLF $command &= "Connection: close"&@CRLF $command &= ""&@CRLF TCPSend($socket, $command) Next EndFunc (...) While (1) If ($start = 1) Then $srcv = TCPRecv($socket, 1288) If ($srcv <> "") Then $x = FileOpen("x.txt", 1) FileWriteLine($x, $srcv) EndIf EndIf i want my script to save the $srcv (quelltext of google results website) in my "x.txt", and this for the first 5 result-pages of google. but when i open the logfile "x.txt" there is only the last website's quelltext in it, why? Edited October 27, 2007 by phew
Blue_Drache Posted October 27, 2007 Posted October 27, 2007 (edited) Because your fileopen command is inside your loop and it's set to OVERWRITE PREVIOUS CONTENTS Edited October 27, 2007 by Blue_Drache Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
phew Posted October 27, 2007 Author Posted October 27, 2007 Because your fileopen command is inside your loop and it's set to OVERWRITE PREVIOUS CONTENTSMode (read or write) to open the file in.Can be a combination of the following: 0 = Read mode 1 = Write mode (append to end of file) 2 = Write mode (erase previous contents)no it isn't
Moderators SmOke_N Posted October 28, 2007 Moderators Posted October 28, 2007 sry for bump, but no one got an idea?You were given an answer... you can't really have a FileOpen() if you don't ever use a FileClose().Why not just use InetGetSource() or InetGet()? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
phew Posted October 28, 2007 Author Posted October 28, 2007 You were given an answer... you can't really have a FileOpen() if you don't ever use a FileClose().Why not just use InetGetSource() or InetGet()?i had a fileclose() somewhere where the (...) code continued but i already fixed it with InetGetSource() and InetGet() but thanks for the suggestion =)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now