scriptbit 0 Posted April 14, 2017 Report Share Posted April 14, 2017 (edited) So I've been using "Automate 6" since 2006 before discovering Ubot like 3 weeks ago. Automate 6 has the ability to let you set up "if" statements as well. One thing most of my Automate 6 bots benefited from was they had actions like "Goto" and "Label". Here's what they look like: http://i64.tinypic.com/2vab8qr.jpg I cannot find an equivalent in Ubot. The way it would work is you would stick a "Goto" anywhere in your code and if you had previously put the "Label" (you give it any name you want) in the code, the task would immediately go to that "Label" and continue from there. Here's my current ubot code: http://i66.tinypic.com/11hcg2u.jpg And here's sort of the equivalent in Automate 6. I just named the Label "PopRocks" as an example: http://i64.tinypic.com/2pt0xab.jpg Is there an equivalent feature of Ubot that allows you to define a certain point in the task and stick a "goto" and the task goes immediately to where you told it to "goto"? I hope that makes sense. I can try to clarify further if needed. Edited April 15, 2017 by scriptbit Quote Link to post Share on other sites
afkratien 12 Posted April 15, 2017 Report Share Posted April 15, 2017 same problem , sometime i need to jump to line xxxx example label : nagative("domain.com") fill accountsolve captchaif captcha = false thengoto label something like that 1 Quote Link to post Share on other sites
zozo31 10 Posted April 15, 2017 Report Share Posted April 15, 2017 I too love those functions in macrotoolwork.. In ubot, "define" is the similar thing to those.. Quote Link to post Share on other sites
afkratien 12 Posted April 15, 2017 Report Share Posted April 15, 2017 I too love those functions in macrotoolwork.. In ubot, "define" is the similar thing to those..if you use "define" as a function , i think a program needs a lot of function like that .in fact , we only need to jump to label . Done Quote Link to post Share on other sites
Kreatus (Ubot Ninja) 422 Posted April 15, 2017 Report Share Posted April 15, 2017 Useful if ubot add something like that. This is how i do something similar doStuff("dothis") define doStuff(#doStuffQuery) { if($comparison(#doStuffQuery,"=","dothis")) { then { alert(#doStuffQuery) } else if($comparison(#doStuffQuery,"=","dothat")) { alert(#doStuffQuery) } else { } } } Quote Link to post Share on other sites
LoWrIdErTJ - BotGuru 904 Posted April 15, 2017 Report Share Posted April 15, 2017 goto is frowned upon because it promotes poor coding practice. Got your back up against the wall, something not working right, lets jump here with a goto instead program in for scenarios that cause issues and how to deal with them propelry and a goto would not be needed. Easy way out is not always the best way out. This may or may not be the case for you and im not trying to bash anyone here. just trying to point out what a mess it can cause in the code. 2 Quote Link to post Share on other sites
scriptbit 0 Posted April 15, 2017 Author Report Share Posted April 15, 2017 I too love those functions in macrotoolwork.. In ubot, "define" is the similar thing to those.. PLEASE give me an example of how you use it like how I am describing Label and Goto. Thank you in advance! Useful if ubot add something like that. This is how i do something similar doStuff("dothis") define doStuff(#doStuffQuery) { if($comparison(#doStuffQuery,"=","dothis")) { then { alert(#doStuffQuery) } else if($comparison(#doStuffQuery,"=","dothat")) { alert(#doStuffQuery) } else { } } } Ok I want to try this.. Where do I put this kind of raw code? Quote Link to post Share on other sites
scriptbit 0 Posted April 15, 2017 Author Report Share Posted April 15, 2017 goto is frowned upon because it promotes poor coding practice. Got your back up against the wall, something not working right, lets jump here with a goto instead program in for scenarios that cause issues and how to deal with them propelry and a goto would not be needed. Easy way out is not always the best way out. This may or may not be the case for you and im not trying to bash anyone here. just trying to point out what a mess it can cause in the code. I was not even aware of "macrotoolwork" but that now makes 2 competing softwares to ubot that have this feature. I see your point that it may not be good coding practice but consider how much faster all our bots would be constructed if only Ubot contained these two features. Everybody who was the Automate and Macrotoolwork customer base would comfortably be able to jump right into Ubot. Automate 6 is built on "Basic" coding language, which honestly I don't know. I stuck with the gui (yeah I'm a noob like that). I don't know how "Basic" programming language works in the raw code of it but seems it will allow for goto and label. What is Ubot built on? However, I will try the solutions presented above. I do see Ubot does have many features that the others don't so I am very excited to try to master it. Just getting through this initial learning curve is where I'm at now. Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted April 15, 2017 Report Share Posted April 15, 2017 yup like Kreatus s or you have you whole sequence in a define "login" ---------------- define login()next list item = abc@abc.com,sdjfl;kjejflkjfill form with login detailshti submitwait for element to existif element not exist login() which means start over again until the list runs out or you have a valid login--------------continue the rest of you bot codepost a tweet to twitter You can use the same login with proxies. Regards,Nick 1 Quote Link to post Share on other sites
Marani 80 Posted April 15, 2017 Report Share Posted April 15, 2017 Interesting, long time ago I found a post from a member who said using Return command with no parameter makes the code go to the beginning of the last loop command (the closest to Return).Might not be "Goto" but, I tested it that time and if remember, it worked for me. Just copy the code you want it to goto in a define you have you whole sequence in a define "login" ---------------- define login()next list item = abc@abc.com,sdjfl;kjejflkjfill form with login detailshti submitwait for element to existif element not exist login() which means start over again until the list runs out or you have a valid login--------------continue the rest of you bot codepost a tweet to twitter You can use the same login with proxies. Regards,Nick Quote Link to post Share on other sites
scriptbit 0 Posted April 15, 2017 Author Report Share Posted April 15, 2017 You guys are geniuses if this works. Im gonna test and let you know if I solved my issue. Thanks!!! Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted April 15, 2017 Report Share Posted April 15, 2017 I use to do that but now I cant remember how exactly. I am trying to make some code but keep getting exceeding list error. but I know that logic worked with proxies and what kreatus has works too but I believe I was using "$random list item" with proxies.oh, wait yause list "position o" and "remove from list @ position 0" lemme work it out, I am tired toosorry CD Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted April 15, 2017 Report Share Posted April 15, 2017 Here is another way to look at it too... clear list(%data) add list to list(%data,$list from text("one@abc.com,ljkfsldkjfs;lkdjf two@abc.com,sld4df5s7f67f7 three@abc.com,lsdjfsl;kdjfg465463",$new line),"Delete","Global") loop while($comparison(%data,"!= Does not equal",$nothing)) { set(#NLI,$list item(%data,0),"Global") comment("this simulates the \"$exitsts\" function") set(#elemnt exists,$spin("\{true|false\}"),"Global") if(#elemnt exists) { then { alert("continue") comment("run you define or code here") remove from list(%data,0) } else { alert("add item to bad list") remove from list(%data,0) comment("and continue back to top") } } } you can do many cool things with loop while Regards,Nick Quote Link to post Share on other sites
Code Docta (Nick C.) 638 Posted April 15, 2017 Report Share Posted April 15, 2017 here is how one might do proxies clear list(%data) add list to list(%data,$list from text("one@abc.com,ljkfsldkjfs;lkdjf two@abc.com,sld4df5s7f67f7 three@abc.com,lsdjfsl;kdjfg465463",$new line),"Delete","Global") clear list(%proxies) add list to list(%proxies,$list from text("123.456.789:8080 456.321.789:1000 555.55.566:888",$new line),"Delete","Global") loop while($comparison(%data,"!= Does not equal",$nothing)) { set(#UI porxy,$test proxy(),"Global") comment("if proxy is good set proxy") if(#UI porxy) { then { change proxy(#UI porxy) } } comment("navigate to site logic") set(#NLI,$list item(%data,0),"Global") comment("this simulates the \"$exitsts\" function") set(#elemnt exists,$spin("\{true|false\}"),"Global") if(#elemnt exists) { then { alert("continue") comment("run you define or code here") remove from list(%data,0) } else { alert("add item to bad list") remove from list(%data,0) comment("and continue back to top") } } } define $test proxy { loop while($comparison(%proxies,"!= Does not equal",$nothing)) { set(#rand proxy,$next list item(%proxies),"Global") comment("reset list pos for continuous loop, at least till the list runs out") if($comparison($list position(%proxies),"= Equals",0)) { then { set list position(%proxies,0) } } if($comparison(%proxies,"= Equals",$nothing)) { then { alert("feed my I am out of proxies.") comment("and/or use stop script") } } comment("test proxy code here and if proxy is good set value to true") if($spin("\{false|true\}")) { then { return(#rand proxy) } else { remove from list(%proxies,0) return("false") } } } } the define command is very powerful you can read more about the define command << there #define Regards,Nick 1 Quote Link to post Share on other sites
HelloInsomnia 1103 Posted April 15, 2017 Report Share Posted April 15, 2017 I know this doesn't directly answer your question and this is quite long, you will need the Local Dictionary plugin as well to see this properly in Ubot but I hope it shows how you can use Defines instead of something like a GoTo Label: clear list(%log) clear list(%accounts) add list to list(%accounts,$list from text("first|1 second|2 third|3 fourth|4 fifth|5",$new line),"Delete","Global") loop($list total(%accounts)) { clear list(%account) add list to list(%account,$list from text($next list item(%accounts),"|"),"Delete","Global") LoginController($list item(%account,0), $list item(%account,1), $rand(1,3)) } define LoginController(#_email, #_password, #_retryCount) { DeclareLoginProperties(#_email, #_password, #_retryCount) loop while($plugin function("LocalDictionary.dll", "$local dictionary get", "loginProcessRunning")) { Login() UpdateLoginStatus() } } define DeclareLoginProperties(#_email, #_password, #_retryCount) { plugin command("LocalDictionary.dll", "local dictionary add", "email", #_email) plugin command("LocalDictionary.dll", "local dictionary add", "password", #_password) plugin command("LocalDictionary.dll", "local dictionary add", "retryCount", 0) plugin command("LocalDictionary.dll", "local dictionary add", "maxRetryCount", #_retryCount) plugin command("LocalDictionary.dll", "local dictionary add", "success", "false") plugin command("LocalDictionary.dll", "local dictionary add", "loginProcessRunning", "true") } define Login { comment("Pretend Login Process") comment("These set commands replace (a) type text; its an example of how we use the local dictonary.") set(#_email,$plugin function("LocalDictionary.dll", "$local dictionary get", "email"),"Local") set(#_password,$plugin function("LocalDictionary.dll", "$local dictionary get", "password"),"Local") set(#_loginSuccessful,$spin("\{true|false|false|false\}"),"Local") plugin command("LocalDictionary.dll", "local dictionary add", "success", #_loginSuccessful) } define Log(#_message) { comment("In this case we just use a list to keep a basic log") add item to list(%log,#_message,"Don\'t Delete","Global") } define UpdateLoginStatus { comment("If the login is successful, log it and return.") if($comparison($plugin function("LocalDictionary.dll", "$local dictionary get", "success"),"=","true")) { then { plugin command("LocalDictionary.dll", "local dictionary add", "loginProcessRunning", "false") Log("Login Process: Successfully logged in account: {$plugin function("LocalDictionary.dll", "$local dictionary get", "email")}") } comment("If it failed, check the retry count, and log.") else { plugin command("LocalDictionary.dll", "local dictionary increment", "retryCount") if($comparison($plugin function("LocalDictionary.dll", "$local dictionary get", "retryCount"),">",$plugin function("LocalDictionary.dll", "$local dictionary get", "maxRetryCount"))) { then { plugin command("LocalDictionary.dll", "local dictionary add", "loginProcessRunning", "false") Log("Login Process: Account: {$plugin function("LocalDictionary.dll", "$local dictionary get", "email")} ... Max retries hit, account Failed to login") } else { set(#_retryAttemptsLeft,$add($subtract($plugin function("LocalDictionary.dll", "$local dictionary get", "maxRetryCount"),$plugin function("LocalDictionary.dll", "$local dictionary get", "retryCount")),1),"Local") Log("Login Process: Account: {$plugin function("LocalDictionary.dll", "$local dictionary get", "email")} login failed, retrying... {#_retryAttemptsLeft} attempts left") } } } } } 1 Quote Link to post Share on other sites
jason 101 Posted April 17, 2017 Report Share Posted April 17, 2017 As has been described, define is the most obvious replacement for this. Use it the same way that you "label" commands inside Automate 6: Essentially, any time you create a defined command, you are building an area of code you can "go to" simply by calling that command's name. The way most here use defined commands is to have one tab with various defined commands (ie labeled sets of code), and then your script in a separate tab that is a series of conditionals that refer back to different defined commands. Quote Link to post Share on other sites
UBotBuddy 331 Posted April 17, 2017 Report Share Posted April 17, 2017 For anyone getting used to UBot Studio there are definitely some programmingconcepts that you won't see here. Thankfully, (and my fingers are crossed too)that "GoTo" statements will never appear. The person who created that ability in the distant past should have been takenout back and shot. Now you know where I stand on that issue. LOL As far as Define commands, I hardly ever use them except in specializedfunctions. The one piece of advice that I give a lot of users when I see themusing Defines is to develop that code outside of the Define. Make sure that itworks 100% of the time and the exact way you want it to run. Debugging codeinside of a Define is impossible simply because you can not watch its executionat least visually. I have about 45 bots scraping 45 different websites and they all are using 95%of the same code. My master source code I will add to a new bot and thentweak out a special section and then I am done. Logic is the key. Using variables is another key. Plan, Plan and Plan. It will make a difference. As TJ mentioned, don't useshortcuts in your coding. There will price to pay if you do at some point eitherwith a lost client or an impossible coding delima to get over. Buddy Quote Link to post Share on other sites
deliter 203 Posted April 26, 2017 Report Share Posted April 26, 2017 edit Quote Link to post Share on other sites
afkratien 12 Posted April 29, 2017 Report Share Posted April 29, 2017 thank to all , finally i find my best way to solve this problem i use define , and loop while . my code is easier and simple 1 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.