rogercd 3 Posted April 12, 2013 Report Share Posted April 12, 2013 Hey guys.So , i just tried using ui button for the first time and it didn't worked at all as i expected it would some i'm abit lost.The fact the you need to asign commands to each button differently is hard to understand for me.I'm trying to build a little script that will navigate to url's from a file. I wanted that at the end of each loop ( each url ) the script pause ( all this i can do np ) and then after the user have clicked on a the proper button restart looping. The purpose of the script was to sort items from a website in different category. i would manually asign each url to the proper category ( list ) that way. So the click on the button would add in item to a list depending on which button have been clicked.I'm not really sure how to do that or if that's even possible. I was thinking of adding a value to the button like a variable and to check the variable value to decide what to do ( Variable = 0 then button has been clicked variable = 1 buttoin hasn't ) and then use Else if: List from a fileLoop > list total Navigate > next list itemPause script ( Or wait for user input ? ) If button1 value = 0 then > add item to list > run script ,Else Else if Button2 value = 0 > add item to list > run ScriptElse Else if Button3 value = 0 > add item to list > Run script, etc.. Do you have another way to proceed ? Can it be done the way i think ?thanks Quote Link to post Share on other sites
AutomationNinja 194 Posted April 13, 2013 Report Share Posted April 13, 2013 You could use alerts. They pause the script until you click the ok button. Plus you can give the user a message. 1 Quote Link to post Share on other sites
rogercd 3 Posted April 13, 2013 Author Report Share Posted April 13, 2013 i don't get how alert would help in that case ? it's just a way to restart the script ? i'm needing 6 buttons each adding different stuff to a list. how the user would choose the proper thing to add to the list without any input ? i can't seem to be able to add button inside altert. Quote Link to post Share on other sites
jomark3 25 Posted April 13, 2013 Report Share Posted April 13, 2013 Hey guys. So , i just tried using ui button for the first time and it didn't worked at all as i expected it would some i'm abit lost. The fact the you need to asign commands to each button differently is hard to understand for me. I'm trying to build a little script that will navigate to url's from a file. I wanted that at the end of each loop ( each url ) the script pause ( all this i can do np ) and then after the user have clicked on a the proper button restart looping. The purpose of the script was to sort items from a website in different category. i would manually asign each url to the proper category ( list ) that way. So the click on the button would add in item to a list depending on which button have been clicked. I'm not really sure how to do that or if that's even possible. I was thinking of adding a value to the button like a variable and to check the variable value to decide what to do ( Variable = 0 then button has been clicked variable = 1 buttoin hasn't ) and then use Else if: List from a fileLoop > list total Navigate > next list itemPause script ( Or wait for user input ? ) If button1 value = 0 then > add item to list > run script ,Else Else if Button2 value = 0 > add item to list > run ScriptElse Else if Button3 value = 0 > add item to list > Run script, etc.. Do you have another way to proceed ? Can it be done the way i think ? thanks Yes, it can be done that way. Drag the ui button into your bot, and give it a variable name (#button1). In the value area, enter 0. Somewhere before your button is executed, set the value of #button1 to 1. This way, if the button is clicked the value of #button1 will equal 0, if the button is not clicked, #button1 will equal 1. (Do the same with buttons 2 and 3.) So your code would look like: List from a fileLoop > list total Navigate > next list itemPause script ( Or wait for user input ? ) If #button1 = 0 then > add item to list > run script ,Else Else if #button2 = 0 > add item to list > run ScriptElse Else if #button3 = 0 > add item to list > Run script, etc.. 1 Quote Link to post Share on other sites
rogercd 3 Posted April 14, 2013 Author Report Share Posted April 14, 2013 Ok i've managed to do this it works only problem is that i cannot restart the script ( or i have to do it manually ) so instead i made a 5seconde counntdown before the if else but it think a run script function could be really nice !Thanks for the helpEdit : Im wondering is there a way to have an empty loop , looping until #button1 or button2 or button3 = 0 ? Edit2 : Ok ive just tried loop while > either > Comparaison #button1 = 0 or Comparaison #button2 = 0 and ubot crashed 3 times in a row i guess that's not good xd Quote Link to post Share on other sites
jomark3 25 Posted April 14, 2013 Report Share Posted April 14, 2013 Create a define that checks the value of each button. if none of the buttons have been clicked, load an html page that says, 'You must click one of the button above to proceed." Then wait 2 seconds and loop back to the top of the define. 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.