HaHaItsJake 25 Posted May 7, 2014 Report Share Posted May 7, 2014 I'm having problems with Multithreading with list and Variables. Now, I have tried everything and look threw all the forums post about this subject. I still yet found a solution. I know I probably coded it the wrong way or something so if someone can shed some light onto this that would be great! It's not in Sockets, I'm not that advance and already have problems with the sockets with an experienced user on here. The following coding below keeps sending the message to the same message_username for all threads. Again, I believe my code is messed up (because I is noob) lmao. Now, I have tired variables to list and have the list $Next list item and still messes up. ui drop down("Threads", "1,5,10,15,20", #Threads) ui stat monitor("Current Threads:", #used threads) ui open file("Message Username", #message_username) ui text box("Username", #username) ui text box("Password", #password) ui drop down("Starting Message", "Greeting,Hi,Hello,Welcome,Dear", #start_message) ui text box("Subject", #message_subject) ui block text("Message", #message_body) ui stat monitor("Queued:", $list total(%load_users)) ui stat monitor("Message Sent", $list total(%Message)) ui stat monitor("Complete (Sent):", $list total(%complete)) ui stat monitor("Invalid (Not Sent):", $list total(%invalid)) ui button("Clear Complete/Invalid") { clear list(%invalid) clear list(%complete) } clear list(%load_users) add list to list(%load_users, $list from file(#message_username), "Delete", "Global") set(#threads to run, #Threads, "Global") set(#used threads, 0, "Global") loop($list total(%load_users)) { loop while($comparison(#used threads, ">=", #threads to run)) { wait(1) } increment(#used threads) thread { in new browser { allow images("No") allow css("No") allow flash("No") Login() Message_Send() decrement(#used threads) } } } define Login { navigate("URL", "Wait") wait for browser event("Page Loaded", "") if($exists(<class="logout">)) { then { click(<class="logout">, "Left Click", "No") wait for browser event("Page Loaded", "") } else { } } type text($element offset(<username field>, 0), #username, "Standard") type text($element offset(<password field>, 0), #password, "Standard") click(<login button>, "Left Click", "No") wait for browser event("Everything Loaded", "") } define Message_Send { loop($list total(%load_users)) { add list to list(%load_users, $list from file(#message_username), "Delete", "Global") navigate("MESSAGE URL", "Wait") wait for browser event("Everything Loaded", "") if($exists(<INNERTEXT>)) { then { type text($element offset(<username field>, 0), #username, "Standard") type text($element offset(<password field>, 0), #password, "Standard") click(<login button>, "Left Click", "No") wait for browser event("Everything Loaded", "") navigate("SITE URL", "Wait") wait for browser event("Everything Loaded", "") } else { } } type text(<name="to_login">, $list item(%load_users, 0), "Standard") type text(<name="message[subject]">, #message_subject, "Standard") type text(<name="message[body]">, "{#start_message} {$list item(%load_users, 0)},{$new line}{#message_body}", "Standard") click($element offset(<id="send">, 1), "Left Click", "No") wait for browser event("Everything Loaded", "") if($exists(<innertext="Message successfully sent">)) { then { add item to list(%Message, "Message Sent-{$list item(%load_users, 0)}", "Delete", "Global") save to file("PATH:\\Documents\\UBOT\\Message Set\\Messages.txt", %Message) set(#complete, "Message Sent-{$list item(%load_users, 0)}", "Global") } else { set(#invalid, "Message not send-{%load_users}", "Global") } } wait for browser event("Everything Loaded", "") remove from list(%load_users, 0) save to file(#message_username, %load_users) add item to list(%complete, #complete, "Delete", "Global") add item to list(%invalid, #invalid, "Delete", "Global") } } I had to edit the URL's and such due to it's a one of a kind project ;P Any help will be awesome! Thanks! Quote Link to post Share on other sites
runsoftware 14 Posted May 7, 2014 Report Share Posted May 7, 2014 If the URLS are in a list you can create a variable called lets say #row and at the end of the thread command you can put a increment for the #row var. then inside the Log In command you need to point it to get the item from list with $list item and the position needs to be the #row variable. This way when it ends creatin a thread the #row value increments and the next thread will search for a item in the next position of the list.maybe you can use $next list item too but sometimes i got problems with this one EDIT: i hope this is what you were looking for. Quote Link to post Share on other sites
HaHaItsJake 25 Posted May 7, 2014 Author Report Share Posted May 7, 2014 If the URLS are in a list you can create a variable called lets say #row and at the end of the thread command you can put a increment for the #row var. then inside the Log In command you need to point it to get the item from list with $list item and the position needs to be the #row variable. This way when it ends creatin a thread the #row value increments and the next thread will search for a item in the next position of the list. maybe you can use $next list item too but sometimes i got problems with this one EDIT: i hope this is what you were looking for. The problem is the Message User. (to_login). It uses the same Username for each thread. So instead of 1 thread picking up user 1, then 2 thread user 2, they're bother user 1. The .txt file is the following Username1username2username3etc type text(<name="to_login">, $list item(%load_users, 0), "Standard") I will try your way and see. I know a-lot of people said "Global/Local" on some of the Set and have $Next List Item for the entry. Just not sure what's the right pattern for it; type text(<name="to_login">, $Next list item(%load_users, 0), "Standard"). Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted May 7, 2014 Report Share Posted May 7, 2014 Here you go ui drop down("Threads", "1,5,10,15,20", #Threads)ui stat monitor("Current Threads:", #used threads)ui open file("Message Username", #message_username)ui text box("Username", #username)ui text box("Password", #password)ui drop down("Starting Message", "Greeting,Hi,Hello,Welcome,Dear", #start_message)ui text box("Subject", #message_subject)ui block text("Message", #message_body)ui stat monitor("Queued:", $list total(%load_users))ui stat monitor("Message Sent", $list total(%Message))ui stat monitor("Complete (Sent):", $list total(%complete))ui stat monitor("Invalid (Not Sent):", $list total(%invalid))ui button("Clear Complete/Invalid") { clear list(%invalid) clear list(%complete)}clear list(%load_users)add list to list(%load_users, $list from file(#message_username), "Delete", "Global")set(#threads to run, #Threads, "Global")set(#used threads, 0, "Global")loop($list total(%load_users)) { loop while($comparison(#used threads, ">=", #threads to run)) { wait(1) } increment(#used threads) thread { in new browser { allow images("No") allow css("No") allow flash("No") Login() Message_Send() decrement(#used threads) } }}define Login { navigate("URL", "Wait") wait for browser event("Page Loaded", "") if($exists(<class="logout">)) { then { click(<class="logout">, "Left Click", "No") wait for browser event("Page Loaded", "") } else { } } type text($element offset(<username field>, 0), #username, "Standard") type text($element offset(<password field>, 0), #password, "Standard") click(<login button>, "Left Click", "No") wait for browser event("Everything Loaded", "")}define Message_Send { loop($list total(%load_users)) { set(#user, $next list item(%load_users), "Local") navigate("MESSAGE URL", "Wait") wait for browser event("Everything Loaded", "") if($exists(<INNERTEXT>)) { then { type text($element offset(<username field>, 0), #username, "Standard") type text($element offset(<password field>, 0), #password, "Standard") click(<login button>, "Left Click", "No") wait for browser event("Everything Loaded", "") navigate("SITE URL", "Wait") wait for browser event("Everything Loaded", "") } else { } } type text(<name="to_login">, #user, "Standard") type text(<name="message[subject]">, #message_subject, "Standard") type text(<name="message[body]">, "{#start_message} {#user},{$new line}{#message_body}", "Standard") click($element offset(<id="send">, 1), "Left Click", "No") wait for browser event("Everything Loaded", "") if($exists(<innertext="Message successfully sent">)) { then { add item to list(%Message, "Message Sent-{#user}", "Delete", "Global") save to file("PATH:\\Documents\\UBOT\\Message Set\\Messages.txt", %Message) set(#complete, "Message Sent-{#user}", "Global") } else { set(#invalid, "Message not send-{#user}", "Global") } } wait for browser event("Everything Loaded", "") save to file(#message_username, %load_users) add item to list(%complete, #complete, "Delete", "Global") add item to list(%invalid, #invalid, "Delete", "Global") }} 1 Quote Link to post Share on other sites
HaHaItsJake 25 Posted May 7, 2014 Author Report Share Posted May 7, 2014 Thank you! I didn't try just the var's where you have them. Was adding them to a Next list item or a list item. Quote Link to post Share on other sites
Patrick_ 4 Posted May 13, 2014 Report Share Posted May 13, 2014 Works like a charm, thank you! 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.