GorgHeLL Posted July 21, 2007 Share Posted July 21, 2007 Hello, I want to make a script that will visit certain webpages (links), i know all that, but so far i have to hard code the links in the script... Is there anyway (and if yes, how) to do that but to have the links in a file? Let's say i have these links: www.link1.com www.link2.com www.link3.com www.link4.com I want to put them in let's say links.txt and the script will take each link (one link per row), open it in explorer, wait 10 secconds and then take the next link in the file and open it in the same window. That's it. Thanks. [font="Tahoma"]pr0tected by smith & wesson[/font] Link to comment Share on other sites More sharing options...
MHz Posted July 21, 2007 Share Posted July 21, 2007 Look at using the _IE*() functions in the help file for reliable results with automating a web browser. That should get you started. Link to comment Share on other sites More sharing options...
rrrm99 Posted July 21, 2007 Share Posted July 21, 2007 look up Stringsplit & Fileread in the help file to find the urls in the links.txt Link to comment Share on other sites More sharing options...
poisonkiller Posted July 21, 2007 Share Posted July 21, 2007 #include <IE.au3> #include <File.au3> FileWrite("links.txt", "www.link1.com" & @CRLF & "www.link2.com" & @CRLF & "www.link3.com" & @CRLF & "www.link4.com") $ie = _IECreate() For $i = 1 to _FileCountLines("links.txt") _IENavigate($ie, FileReadLine("links.txt", $i)) Sleep(10000) Next Link to comment Share on other sites More sharing options...
GorgHeLL Posted July 21, 2007 Author Share Posted July 21, 2007 #include <IE.au3> #include <File.au3> FileWrite("links.txt", "www.link1.com" & @CRLF & "www.link2.com" & @CRLF & "www.link3.com" & @CRLF & "www.link4.com") $ie = _IECreate() For $i = 1 to _FileCountLines("links.txt") _IENavigate($ie, FileReadLine("links.txt", $i)) Sleep(10000) Next Thanks you very much for this pice of code... It works great, just like i wanted. [font="Tahoma"]pr0tected by smith & wesson[/font] Link to comment Share on other sites More sharing options...
figgler Posted July 21, 2007 Share Posted July 21, 2007 (edited) I like ini files so here goes :lol #include <IE.au3> ; Link List ini file $LinkFile = @ScriptDir & "\Link.ini" $ie = _IECreate() ; Just for test ;Just make the ini take this out and make the ini your self IniWriteSection($LinkFile, "www.link1.com", "") IniWriteSection($LinkFile, "www.link2.com", "") IniWriteSection($LinkFile, "www.link3.com", "") ;loop the ini $Sections = IniReadSectionNames($LinkFile) If @error Then MsgBox(48, "Error", "The " & $LinkFile & " file is either missing or has no entries !") Else For $i = 1 To $Sections[0] _IENavigate($ie, $Sections[$i]) Sleep(10000) Next EndIf Edited July 21, 2007 by figgler Link to comment Share on other sites More sharing options...
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