dvlkn Posted May 8, 2008 Posted May 8, 2008 Hello I am fairly new to AutoIt and I need help on the following. I wrote a script to automatically surf web pages and copy some data off it. My problem is, there are about 15 web pages to visit and I don't know how to create the appropriate loop so that it enters the address of the next link but perform the same process (i.e copy / paste data into notepad) At the moment I merely reproduced the same portion of code but each with different addresses to do the job but then the code is so long My code looks like this: (for 1 web page) WinActivate ("Mozilla Firefox") MouseClick ("Left", 446, 67) Sleep 300 Send ("address of webpage here") [color="#0000FF"]this is what I want to loop to go through several web pages[/color] Send ("{ENTER}") Sleep (5000) MouseMove ("71, 331, 50") [color="#0000FF"]this is the task to be performed on each page[/color] Sleep (500) MouseDown ("Left") Sleep (500) MouseMove ("769, 669") Sleep (500) MouseUp ("Left") Sleep (500) Send ("^c") Sleep (500) WinActivate ("untitled - notepad") Sleep (500) Send ("^v") Sleep (500) WinActivate ("Mozilla Firefox") Any help would be greatly appreciated.
Moderators SmOke_N Posted May 8, 2008 Moderators Posted May 8, 2008 1. It would probably be much more efficient to use the IE* functions. 2. Put each link and window title into an array: ... pseudo: ... aLinks[16] = ["", "http://www.etc1", "http://www.etc2", etc] ... aTitles[16] = ["", "Title 1", "Title 2"];Not a fan .... IE* funcs would be easier with objects created, but if you must: 3. Create a For/Next loop For $i = 1 to 15 ShellExecute($aLinks[$i]) WinWait($aTitles[$i]) Execute rest Next So in essence you could create an array for each thing to do and sum up your operation in very few lines. 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.
dvlkn Posted May 9, 2008 Author Posted May 9, 2008 Yes that was what am looking for , I can take it on from now. Tyvm
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