dankass 52 Posted May 9, 2013 Report Share Posted May 9, 2013 UPDATE - NOW WORKS WITH ALL VERSIONS OF UBOT STUDIO (see below for standard/pro version) I needed a small progress bar for a project I'm working on and wanted it to be "lightweight" and easy to work with without a lot of 'riff-raff'.It worked so well I thought I'd share it with all of you. I've attached code and .ubot file. Notes:This is accomplished using HTML5Displays in HTML UI Panel (Dev Only)Updated to display rounded numbers in % set(#progress, 0, "Global") ui html panel("<body> <progress variable=\"#progress\" fillwith=\"value\" max=\"100\" style=\"width:300px;\"></progress> <b><span variable=\"#progress\" fillwith=\"innerhtml\"></span>%</b> </body>", "") set(#looptotal, 17, "Global") set(#loopcount, 1, "Global") loop(#looptotal) { load html("Loop: {#loopcount} of {#looptotal}") set(#progress, $eval("var tmp1 = {$multiply($divide(#loopcount, #looptotal), 100)}; tmp2 = Math.floor(tmp1); tmp2"), "Global") increment(#loopcount) } Cheers! UPDATE: Now Works with Standard and PROFigured out a nice workaround for the Ubot Studio Standard & Pro folks to stick this in the regular UI panel. See code below, or download the HTML5ProgressbarSTD.ubot file for STD or PRO users. set(#progress, 0, "Global") ui stat monitor("<progress value=\"{#progress}\" max=\"100\"></progress>", "{#progress}%") set(#looptotal, 17, "Global") set(#loopcount, 1, "Global") loop(#looptotal) { load html("Loop: {#loopcount} of {#looptotal}") set(#progress, $eval("var tmp1 = {$multiply($divide(#loopcount, #looptotal), 100)}; tmp2 = Math.floor(tmp1); tmp2"), "Global") increment(#loopcount) } HTML5ProgressBarSTD.ubotHTML5ProgressBarDEV.ubot 20 Quote Link to post Share on other sites
ecbzh 47 Posted May 9, 2013 Report Share Posted May 9, 2013 Thanks ! Quote Link to post Share on other sites
satya17 3 Posted May 9, 2013 Report Share Posted May 9, 2013 Thanks dude Quote Link to post Share on other sites
tlinfo 0 Posted May 9, 2013 Report Share Posted May 9, 2013 Thanks Quote Link to post Share on other sites
darryl561 177 Posted May 9, 2013 Report Share Posted May 9, 2013 Thats impressive. I can't believe the tiny amount of code you achieved this with. Quote Link to post Share on other sites
luis carlos 94 Posted May 9, 2013 Report Share Posted May 9, 2013 Thanks Dankass. For Pro and Std Version, can try it clicking on the "start" button with this code: set(#progress, 0, "Global") ui html panel("<body> <progress variable=\"#progress\" fillwith=\"value\" max=\"100\" style=\"width:300px;\"></progress> <b><span variable=\"#progress\" fillwith=\"innerhtml\"></span>%</b> </body><br><br><br> <button onclick=\"ubot.runScript(\'algo()\')\">Start</button>", "") define algo { set(#looptotal, 20, "Global") set(#loopcount, 1, "Global") loop(#looptotal) { load html("Loop: {#loopcount} of {#looptotal}") set(#progress, $eval($multiply($divide(#loopcount, #looptotal), 100)), "Global") increment(#loopcount) } } 4 Quote Link to post Share on other sites
Bliss 194 Posted May 9, 2013 Report Share Posted May 9, 2013 nice Quote Link to post Share on other sites
Aymen 385 Posted May 9, 2013 Report Share Posted May 9, 2013 awesome work man !simple and effective ! Quote Link to post Share on other sites
giganut 109 Posted May 9, 2013 Report Share Posted May 9, 2013 Awesome thanks for sharing this Quote Link to post Share on other sites
dankass 52 Posted May 9, 2013 Author Report Share Posted May 9, 2013 Glad you guys like it Quote Link to post Share on other sites
Kreatus (Ubot Ninja) 422 Posted May 9, 2013 Report Share Posted May 9, 2013 Wow. I wonder where that animated green bar came from?Cant find it from the source. Thanks for sharing this. Quote Link to post Share on other sites
Aymen 385 Posted May 9, 2013 Report Share Posted May 9, 2013 Wow. I wonder where that animated green bar came from?Cant find it from the source. Thanks for sharing this. its a new tag from HTML5 ! put the html tag and it will show automatically ! Quote Link to post Share on other sites
Kreatus (Ubot Ninja) 422 Posted May 9, 2013 Report Share Posted May 9, 2013 its a new tag from HTML5 ! put the html tag and it will show automatically !Nice.. Quote Link to post Share on other sites
UBotDev 276 Posted May 9, 2013 Report Share Posted May 9, 2013 Nice and simple. Nice share. Quote Link to post Share on other sites
richim1 2 Posted May 10, 2013 Report Share Posted May 10, 2013 Wow simple and cool! Quote Link to post Share on other sites
Anonym 53 Posted May 10, 2013 Report Share Posted May 10, 2013 Very nice indeed! Thanks mate! Quote Link to post Share on other sites
zdot 14 Posted May 11, 2013 Report Share Posted May 11, 2013 really cool! love it! thxxxxxxxxxxxxx Quote Link to post Share on other sites
julius 5 Posted May 12, 2013 Report Share Posted May 12, 2013 Following TJ's multithreading process, I came up with this... ui html panel("<!doctype html> <html> <head> <meta charset=utf-8> <title></title> <style> progress \{ height: 50px; width: 300px; \} span \{ position: absolute; margin-left: 130px; margin-top: 12px; \} </style> </head> <body> <form> <span><b variable=\"#prog\" fillwith=\"innertext\"></b> %</span> <progress min=\"0\" max=\"100\" value=\"0\" variable=\"#prog\" fillwith=\"value\"></progress> </form> </body> </html>", 150) set(#prog, 0, "Global") set(#num threads, 17, "Global") set(#number accounts, 87, "Global") set(#num created, 0, "Global") set(#used threads, 0, "Global") loop(#number accounts) { loop while($comparison(#used threads, ">=", #num threads)) { wait(1) } loop process() } define loop process { increment(#used threads) increment(#num created) registration procedure() } define registration procedure { thread { set(#prog, $eval("var worknum = {$multiply($divide(#num created, #number accounts), 100)}; worknumrnd = Math.floor(worknum); worknumrnd"), "Global") decrement(#used threads) wait(1) } } 2 Quote Link to post Share on other sites
dankass 52 Posted May 14, 2013 Author Report Share Posted May 14, 2013 Thanks everyone who has contributed to some other great twists for this! It inspired me to take the time to find a simple/easy way to stick the same basic setup in the standard UI panel for standard and pro users. I've updated the original post with a version that will work for yall too. Cheers! Quote Link to post Share on other sites
dankass 52 Posted May 14, 2013 Author Report Share Posted May 14, 2013 Following TJ's multithreading process, I came up with this... set(#prog, $eval("var worknum = {$multiply($divide(#num created, #number accounts), 100)}; worknumrnd = Math.floor(worknum); worknumrnd"), "Global") Thanks! That Math.floor part is what I've been trying to figure out to be able to release the standard & pro version to get it to round and display right. I was doing it with a paid plugin but didn't really want to post free code that required a paid plugin, so that did just the trick! Quote Link to post Share on other sites
orbital 15 Posted June 2, 2013 Report Share Posted June 2, 2013 Thanks for this. Just used it in one of my bots and it worked GREAT!! Quote Link to post Share on other sites
jimbourekas@yahoo.gr 1 Posted June 12, 2013 Report Share Posted June 12, 2013 very nice, thanks! Quote Link to post Share on other sites
Evernano 2 Posted July 14, 2013 Report Share Posted July 14, 2013 Nice work, thanks dude... Quote Link to post Share on other sites
steelersfan 38 Posted July 19, 2013 Report Share Posted July 19, 2013 Very useful and very cool! Thanks a lot! Quote Link to post Share on other sites
Buckethead 1 Posted August 15, 2013 Report Share Posted August 15, 2013 Hi, just a quick question , when i tried to use this code in my bot, I can't seem to get the percentage incrememts of the loading bar to match the progress of my bot, see this code here: set(#looptotal, 20, "Global")set(#loopcount, 1, "Global") I want the loading bar to cycle through the loop count that corresponds with the number of urls it visits from a text file,where loop count = each url out of say 100 urls in the text file, so 100 would be the looptotal, but how do I define it so it automatically works out the number by the amount of urls in the text file (because the number of url's in text file will vary) how would I best go about changing this code for that purpose? 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.