Guest kiseki Posted June 18, 2013 Report Share Posted June 18, 2013 Hi, I'm still a newbie about Ubot. and Ive created a loop so my csv file which contains my accounts that will automatically fill up to the designated field, and click register, then after veriying it will redirect me to another page where i can input again the the same information that already fill up in the first creation. then I will need to scrape that information including the public url and save it to the designated csv file. where should I put the increment command so it will go to the next row when after successfully creating an account. PS: Inside my first loop I also have 2 other loops and if command which have different variables and list, because i need it to connect two time for the mail server. Thank you.Kiseki Quote Link to post Share on other sites
VaultBoss 310 Posted June 18, 2013 Report Share Posted June 18, 2013 If you know for sure how many times a loop may have to run, then you don't need an increment if you're not using that as a variable to pull data specifically from a certain list item or table cell, etc......because a simple LOOP will automatically restart from its beginning for the set number of times you specified. However, if you NEED the loop index to select list items with $list item or table cells, etc... then you will use the increment command at the end of the instructions contained in a LOOP WHILE so that you instruct the loop to restart, as long as its condition is still met, after the increment. If you are looping backwards (very useful, many times) then you can even place a decrement command at the beginning of the loop. Quote Link to post Share on other sites
Guest kiseki Posted June 19, 2013 Report Share Posted June 19, 2013 (edited) This is the code view of what im working on right now..please let me know what is wrong about it. thanks... navigate("http://www.website.com", "Wait")wait(3)ui text box("Posting Title", #Posting Title)ui block text("Description", #Description)ui open file("Image", #Imagefile)ui text box("Email", #Email)ui text box("Password", #password)navigate("http://www.website.com", "Wait")wait for browser event("Everything Loaded", "")type text(<name="subject">, #Posting Title, "Standard")wait(5)type text(<class="redactor_ redactor_editor">, #Description, "Standard")wait(5)type text(<id="tag_1">, "house cleaning", "Standard")wait(2)type text(<tabindex=2>, "house cleaners", "Standard")wait(2)type text(<tabindex=3>, "cleaning house", "Standard")wait(2)change file field(<name="img_name_input[1]">, #Imagefile)wait(2)type text(<name="mapStreet">, "Address", "Standard")wait(1)type text(<city field>, "City", "Standard")wait(4)type text(<name="mapZip">, 01772, "Standard")wait(5)click(<id="showInMapButton">, "Left Click", "No")wait(5)type text($element offset(<email field>, 0), #Email, "Standard")wait(2)type text($element offset(<email field>, 1), #Email, "Standard")wait(5)pause scriptclick(<name="post_directly">, "Left Click", "No")wait for browser event("Everything Loaded", "")if($search page("Sorry")) { then { alert("Your account is not successful") pause script } else { alert("Success") wait(5) }}connect to mail server("POP3 With SSL", #Email, #password, "pop3.live.com", 995) { create table from emails(&emails) set(#rowcounter, 0, "Global") loop($table total rows(&emails)) { if($contains($table cell(&emails, #rowcounter, 2), "Activate")) { then { load html($table cell(&emails, #rowcounter, 5)) wait(5) click(<style="color: #fff; text-decoration: none;">, "Left Click", "No") } } increment(#rowcounter) }}wait for browser event("Page Loaded", "")if($search page("Activated.")) { then { alert("Your Post has been activated") click(<value="Proceed">, "Left Click", "No") } else { alert("Its Not been activated") pause script }}wait for browser event("Page Loaded", "")navigate("https://www.website.com", "Wait")wait(5)type text(<email field>, #Email, "Standard")wait(1)click(<value="register">, "Left Click", "No")click(<id="contact_button">, "Left Click", "No")wait for element(<id="captcha">, "", "Appear")type text($element offset(<email field>, 1), #Email, "Standard")wait(3)wait for element(<outerhtml=w"<img id=\"captcha\" src=\"/run/captcha/*\" width=\"*\" height=\"*\">">, "", "Appear")type text(<name="response_field">, $solve captcha(<outerhtml=w"<img id=\"captcha\" src=\"/run/captcha/*\" width=\"*\" height=\"*\">">), "Standard")wait(3)click(<value="Register">, "Left Click", "No")wait for element(<innertext="Next step:">, "", "Appear")connect to mail server("POP3 With SSL", #Email, #password, "pop3.live.com", 995) { create table from emails(&emails2) set(#rowcounter2, 0, "Global") loop($table total rows(&emails2)) { if($contains($table cell(&emails2, #rowcounter2, 2), "Locanto: Activate your account")) { then { load html($table cell(&emails2, #rowcounter2, 5)) wait(5) wait for element(<src="website.com">, "", "Appear") click(<innertext="here">, "Left Click", "No") } } increment(#rowcounter2) }}wait for browser event("Everything Loaded", "")reset account("Any")set(#gender, $account data("Gender"), "Global")type text(<name="nickname">, $account data("Username"), "Standard")type text(<name="given_name">, $account data("First Name"), "Standard")if($comparison(#gender, "=", "Male")) { then { click(<id="salutation_mr">, "Left Click", "No") } else { click(<id="salutation_mrs">, "Left Click", "No") }}wait(1)type text(<name="name">, $account data("Last Name"), "Standard")wait(1)change dropdown(<name="standard_areaID">, "Sydney")wait(1)type text($element offset(<password field>, 0), #password, "Standard")wait(1)type text($element offset(<password field>, 1), #password, "Standard")wait(1)change checkbox(<terms of service checkbox>, "Checked")wait(10)click(<value="Save password & log in">, "Left Click", "No")wait for browser event("Everything Loaded", "")click(<innertext="click to proceed">, "Left Click", "No")wait for browser event("Everything Loaded", "")set(#publicurl, $scrape attribute(<outerhtml=w"<a href=\"http://website.com/ID_*.html\">*">, "href"), "Global")add item to list(%accounts, "{$account data("Username")}, {#password}, {#Email},{#password}, {#Posting Title},{#publicurl}", "Delete", "Global")save to file("{$special folder("Desktop")}\\file.csv", %accounts)click(<outerhtml=w"<a href=\"http://website.com/ID_*.html\">*">, "Left Click", "No")clear cookies here is the code view of the bot im working on..actually I want to pull data from a csv file one row increement and each time the whole process are done then it will automatically get the new data in the next row. if anyone can help Thanks in advance. Edited June 19, 2013 by kiseki Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted June 24, 2013 Report Share Posted June 24, 2013 Try this navigate("http://www.website.com", "Wait")wait(3)ui text box("Posting Title", #Posting Title)ui block text("Description", #Description)ui open file("Image", #Imagefile)ui text box("Email", #Email)ui text box("Password", #password)navigate("http://www.website.com", "Wait")wait for browser event("Everything Loaded", "")type text(<name="subject">, #Posting Title, "Standard")wait(5)type text(<class="redactor_ redactor_editor">, #Description, "Standard")wait(5)type text(<id="tag_1">, "house cleaning", "Standard")wait(2)type text(<tabindex=2>, "house cleaners", "Standard")wait(2)type text(<tabindex=3>, "cleaning house", "Standard")wait(2)change file field(<name="img_name_input[1]">, #Imagefile)wait(2)type text(<name="mapStreet">, "Address", "Standard")wait(1)type text(<city field>, "City", "Standard")wait(4)type text(<name="mapZip">, 01772, "Standard")wait(5)click(<id="showInMapButton">, "Left Click", "No")wait(5)type text($element offset(<email field>, 0), #Email, "Standard")wait(2)type text($element offset(<email field>, 1), #Email, "Standard")wait(5)pause scriptclick(<name="post_directly">, "Left Click", "No")wait for browser event("Everything Loaded", "")if($search page("Sorry")) { then { alert("Your account is not successful") pause script } else { alert("Success") wait(5) }}connect to mail server("POP3 With SSL", #Email, #password, "pop3.live.com", 995) { create table from emails(&emails) comment("If your tables don't have headers ie EMAIL,LINK,USERNAME etcthen leave at -1 then it will start on row 0 which is the first row.In this case increment needs to be at beginning of loopto not exceed table total rows. If you do have headers changeit back to 0 (zero) so it starts on row 2 (position 1). List and tables are zero basedwhich means they start at zero and then 1,2,3 and so on. Not 1,2,3 but0,1,2,3,4,5. Look in debugger everything starts at 0.") set(#rowcounter, "-1", "Global") loop($table total rows(&emails)) { increment(#rowcounter) if($contains($table cell(&emails, #rowcounter, 2), "Activate")) { then { load html($table cell(&emails, #rowcounter, 5)) wait(5) click(<style="color: #fff; text-decoration: none;">, "Left Click", "No") } } }}wait for browser event("Page Loaded", "")if($search page("Activated.")) { then { alert("Your Post has been activated") click(<value="Proceed">, "Left Click", "No") } else { alert("Its Not been activated") pause script }}wait for browser event("Page Loaded", "")navigate("https://www.website.com", "Wait")wait(5)type text(<email field>, #Email, "Standard")wait(1)click(<value="register">, "Left Click", "No")click(<id="contact_button">, "Left Click", "No")wait for element(<id="captcha">, "", "Appear")type text($element offset(<email field>, 1), #Email, "Standard")wait(3)wait for element(<outerhtml=w"<img id=\"captcha\" src=\"/run/captcha/*\" width=\"*\" height=\"*\">">, "", "Appear")type text(<name="response_field">, $solve captcha(<outerhtml=w"<img id=\"captcha\" src=\"/run/captcha/*\" width=\"*\" height=\"*\">">), "Standard")wait(3)click(<value="Register">, "Left Click", "No")wait for element(<innertext="Next step:">, "", "Appear")connect to mail server("POP3 With SSL", #Email, #password, "pop3.live.com", 995) { create table from emails(&emails2) set(#rowcounter2, "-1", "Global") loop($table total rows(&emails2)) { increment(#rowcounter2) if($contains($table cell(&emails2, #rowcounter2, 2), "Locanto: Activate your account")) { then { load html($table cell(&emails2, #rowcounter2, 5)) wait(5) wait for element(<src="website.com">, "", "Appear") click(<innertext="here">, "Left Click", "No") } } }}wait for browser event("Everything Loaded", "")reset account("Any")set(#gender, $account data("Gender"), "Global")type text(<name="nickname">, $account data("Username"), "Standard")type text(<name="given_name">, $account data("First Name"), "Standard")if($comparison(#gender, "=", "Male")) { then { click(<id="salutation_mr">, "Left Click", "No") } else { click(<id="salutation_mrs">, "Left Click", "No") }}wait(1)type text(<name="name">, $account data("Last Name"), "Standard")wait(1)change dropdown(<name="standard_areaID">, "Sydney")wait(1)type text($element offset(<password field>, 0), #password, "Standard")wait(1)type text($element offset(<password field>, 1), #password, "Standard")wait(1)change checkbox(<terms of service checkbox>, "Checked")wait(10)click(<value="Save password & log in">, "Left Click", "No")wait for browser event("Everything Loaded", "")click(<innertext="click to proceed">, "Left Click", "No")wait for browser event("Everything Loaded", "")set(#publicurl, $scrape attribute(<outerhtml=w"<a href=\"http://website.com/ID_*.html\">*">, "href"), "Global")add item to list(%accounts, "{$account data("Username")}, {#password}, {#Email},{#password}, {#Posting Title},{#publicurl}", "Delete", "Global")save to file("{$special folder("Desktop")}\\file.csv", %accounts)click(<outerhtml=w"<a href=\"http://website.com/ID_*.html\">*">, "Left Click", "No")clear cookies You also want clear cookies before navigating to sitehope that helps TC Quote Link to post Share on other sites
kiseki 0 Posted June 24, 2013 Report Share Posted June 24, 2013 WOWWWW!!!!.....THANKS!!!!!!.....Your the man Traffik Cop....why I havent think about that...But can i short the code so it wont take so much space?... Quote Link to post Share on other sites
kiseki 0 Posted June 24, 2013 Report Share Posted June 24, 2013 Anyways got it solve thanks.... Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.