JakeLynagh Posted January 24, 2008 Share Posted January 24, 2008 (edited) Hi. I have written a script that makes a number of accounts at a social bookmarking website (like Digg) and saves them to accounts.txt Now I am half way through making another one, that uses accounts.txt to login to the site and submit a link to another website. But I am stuck, I can only get it to do it for the first account on the list. My code is below, can anyone tell me how I can get it to repeat for every account on the list (they are each on a new line) #include <IE.au3> #Region --- IE-Builder generated code Start --- #include <File.au3> $accounts = FileOpen("accounts.txt", 0) $line = FileReadLine($accounts) $len = StringLen($line) $location = StringInStr($line, " ", 0, 1) $location = $location -1 $username = StringLeft($line, $location) $location = $len - $location -1 $password = StringRight($line, $location) $link = InputBox("", "What link do you want to add?", "http://www.") $title = InputBox("", "What is the title of your link?): ", "Title") $desc = InputBox("", "A breif description of the story:", "Description") $tags = InputBox("", "Tags for the story, (comma-separated): ", "tag1, tag2, tag3, etc.") $o_IE = _IECreate () $site = ("https://www.bookmarkingsite.com") _IENavigate ($o_IE, $site) MouseClick("left", 400, 460 ) Send("{tab}" & $username & "{tab}" & $password & "{tab}{enter}") Sleep(5000) _IENavigate ($o_IE, "https://www.bookmarkingsite.com/Add") MouseClick("left", 400, 360 ) Send("{tab}" & $title & "{tab}" & $link & "{tab}{tab}" & $desc & "{tab}" & $tags & "{tab}{enter}") Edited January 24, 2008 by JakeLynagh Link to comment Share on other sites More sharing options...
Achilles Posted January 24, 2008 Share Posted January 24, 2008 expandcollapse popup#include <IE.au3> #Region --- IE-Builder generated code Start --- #include <File.au3> $accounts = FileOpen("accounts.txt", 0) Dim $infoArray _FileReadToArray('accounts.txt', $infoArray) For $i = 1 to UBound($infoArray) $line = FileReadLine($accounts, $i) $len = StringLen($line) $location = StringInStr($line, " ", 0, 1) $location = $location -1 $username = StringLeft($line, $location) $location = $len - $location -1 $password = StringRight($line, $location) $link = InputBox("", "What link do you want to add?", "http://www.") $title = InputBox("", "What is the title of your link?): ", "Title") $desc = InputBox("", "A breif description of the story:", "Description") $tags = InputBox("", "Tags for the story, (comma-separated): ", "tag1, tag2, tag3, etc.") $o_IE = _IECreate () $site = ("https://www.bookmarkingsite.com") _IENavigate ($o_IE, $site) MouseClick("left", 400, 460 ) Send("{tab}" & $username & "{tab}" & $password & "{tab}{enter}") Sleep(5000) _IENavigate ($o_IE, "https://www.bookmarkingsite.com/Add") MouseClick("left", 400, 360 ) Send("{tab}" & $title & "{tab}" & $link & "{tab}{tab}" & $desc & "{tab}" & $tags & "{tab}{enter}") NextI'm not sure if this is exactly what you want but is should lead in the right direction. The For... Next loop is a key feature in repeating a set of steps a certain amount of times... The UBound command simply gets the size of the array.. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
JakeLynagh Posted January 24, 2008 Author Share Posted January 24, 2008 Thanks, I will try it later, right now that site it was used for is down. expandcollapse popup#include <IE.au3> #Region --- IE-Builder generated code Start --- #include <File.au3> $accounts = FileOpen("accounts.txt", 0) Dim $infoArray _FileReadToArray('accounts.txt', $infoArray) For $i = 1 to UBound($infoArray) $line = FileReadLine($accounts, $i) $len = StringLen($line) $location = StringInStr($line, " ", 0, 1) $location = $location -1 $username = StringLeft($line, $location) $location = $len - $location -1 $password = StringRight($line, $location) $link = InputBox("", "What link do you want to add?", "http://www.") $title = InputBox("", "What is the title of your link?): ", "Title") $desc = InputBox("", "A breif description of the story:", "Description") $tags = InputBox("", "Tags for the story, (comma-separated): ", "tag1, tag2, tag3, etc.") $o_IE = _IECreate () $site = ("https://www.bookmarkingsite.com") _IENavigate ($o_IE, $site) MouseClick("left", 400, 460 ) Send("{tab}" & $username & "{tab}" & $password & "{tab}{enter}") Sleep(5000) _IENavigate ($o_IE, "https://www.bookmarkingsite.com/Add") MouseClick("left", 400, 360 ) Send("{tab}" & $title & "{tab}" & $link & "{tab}{tab}" & $desc & "{tab}" & $tags & "{tab}{enter}") NextI'm not sure if this is exactly what you want but is should lead in the right direction. The For... Next loop is a key feature in repeating a set of steps a certain amount of times... The UBound command simply gets the size of the array.. Link to comment Share on other sites More sharing options...
JakeLynagh Posted January 24, 2008 Author Share Posted January 24, 2008 Okay, that repeats it, thats not what I want done. I have a list of usernames and passwords created by my other bot like: User Pass User Pass User Pass User Pass User Pass User Pass What I had got The top one and did what I wanted it to do, yours just repeated that with the top account, I want it to do the top on once, then go to the second account, then the third etc. This is my code now: expandcollapse popup#include <IE.au3> #Region --- IE-Builder generated code Start --- #include <File.au3> $accounts = FileOpen("accounts.txt", 0) $line = FileReadLine($accounts) $len = StringLen($line) $location = StringInStr($line, " ", 0, 1) $location = $location -1 $username = StringLeft($line, $location) $location = $len - $location -1 $password = StringRight($line, $location) $link = InputBox("", "What link do you want to add?", "http://www.") $title = InputBox("", "What is the title of your link?): ", "Title") $desc = InputBox("", "A breif description of the story:", "Description") $tags = InputBox("", "Tags for the story, (comma-separated): ", "tag1, tag2, tag3, etc.") Dim $infoArray _FileReadToArray('accounts.txt', $infoArray) For $i = 1 to UBound($infoArray) $o_IE = _IECreate () $site = ("https://www.website.com/Main") _IENavigate ($o_IE, $site) MouseClick("left", 400, 500 ) Send("{tab}"& $username & "{tab}" & $password & "{enter}") Sleep(5000) _IENavigate ($o_IE, "https://www.website.com/AddLink") MouseClick("left", 400, 360 ) Send("{tab}" & $title & "{tab}" & $link & "{tab}{tab}" & $desc & "{tab}" & $tags & "{tab}{enter}") _IENavigate ($o_IE, "https://www.website.com/Logout") Next Can anyone help? Link to comment Share on other sites More sharing options...
stampy Posted January 24, 2008 Share Posted January 24, 2008 Get the user and password during the loop expandcollapse popup#include <IE.au3> #Region --- IE-Builder generated code Start --- #include <File.au3> $link = InputBox("", "What link do you want to add?", "http://www.") $title = InputBox("", "What is the title of your link?): ", "Title") $desc = InputBox("", "A breif description of the story:", "Description") $tags = InputBox("", "Tags for the story, (comma-separated): ", "tag1, tag2, tag3, etc.") Dim $infoArray _FileReadToArray('accounts.txt', $infoArray) For $i = 1 to UBound($infoArray) $len = StringLen($infoArray[$i]) $location = StringInStr($infoArray[$i], " ", 0, 1) $location = $location -1 $username = StringLeft($infoArray[$i], $location) $location = $len - $location -1 $password = StringRight($infoArray[$i], $location) $o_IE = _IECreate () $site = ("https://www.website.com/Main") _IENavigate ($o_IE, $site) MouseClick("left", 400, 500 ) Send("{tab}"& $username & "{tab}" & $password & "{enter}") Sleep(5000) _IENavigate ($o_IE, "https://www.website.com/AddLink") MouseClick("left", 400, 360 ) Send("{tab}" & $title & "{tab}" & $link & "{tab}{tab}" & $desc & "{tab}" & $tags & "{tab}{enter}") _IENavigate ($o_IE, "https://www.website.com/Logout") Next Link to comment Share on other sites More sharing options...
glasglow Posted January 26, 2008 Share Posted January 26, 2008 (edited) Just loop through the list(s) While 1 $homey = $homey + 1 $name= FileReadLine($file_in) $pass= FileReadLine($file2_in) If @error = -1 Then ExitLoop; (Sorry I needed to edit this) I just saw something.. you are using arrays.. you can if I am not mistake also loop through the array but the difference between yours and mine is I am using FileReadLine and you are using Array.... Edited January 26, 2008 by glasglow Link to comment Share on other sites More sharing options...
Squirrely1 Posted January 26, 2008 Share Posted January 26, 2008 @JakeLynagh - One could wonder why you would want to automate a social networking site, are you some sort of Maoist social engineer or do you want a computer to decide for you which are the loveliest women posting there? Das Häschen benutzt Radar 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