Learjet 27 Posted March 31, 2016 Report Share Posted March 31, 2016 I've searched and read nearly all of the aftermarket scheduler threads however I'm still wondering if anyone has a recommendation regarding a scheduler that works with compiled bots. Ultimately, I'm hoping to find one that doesn't require going into Windows to setup a task scheduler, hopefully it will take care of that for the customer. Thanks peeps! Peace,LJ Quote Link to post Share on other sites
kev123 132 Posted April 1, 2016 Report Share Posted April 1, 2016 Are you looking for you application to be closed and then opened and run and then closed again or are you looking for a task within your application to be scheduled after x amount of time Quote Link to post Share on other sites
Learjet 27 Posted April 1, 2016 Author Report Share Posted April 1, 2016 Thanks for the response Kev, I can leave it open, most of the things that I code are pretty lightweight. Thanks again! Peace,LJ Quote Link to post Share on other sites
kev123 132 Posted April 1, 2016 Report Share Posted April 1, 2016 ui stat monitor("Status",#status) ui button("start") { sched() set(#status,"scheduler started","Global") } ui button("stop") { set(#status,"scheduler stopping","Global") set(#runbot,$false,"Global") } ui drop down("Time mins","1,3,5,10,15,20,25,30,60,90",#time) define sched { set(#runattime,$multiply(#time,60),"Global") set(#currentime,0,"Global") set(#nextruntime,$subtract(#runattime,#currentime),"Global") thread { set(#runbot,$true,"Global") loop while($comparison(#runbot,"= Equals",$true)) { set(#status,"Next run in {#nextruntime} Seconds","Global") wait(10) if($comparison(#runbot,"= Equals",$false)) { then { set(#status,"scheduler stopped","Global") return(" ") } } set(#currentime,$add(#currentime,10),"Global") set(#nextruntime,$subtract(#runattime,#currentime),"Global") if($comparison(#currentime,">= Greater than or equal to",#runattime)) { then { set(#currentime,0,"Global") set(#status,"Running Task","Global") TaskToComplete() } } } set(#status,"scheduler stopped","Global") } } define TaskToComplete { load html("just ran!") wait(5) } depends how deep you want to go, I've built some insanely complex schedulers in .net and on the same note I've built simple schedulers in ubot that took 5 mins to make. I can't find any source code for ubot as its that long since I've programmed them but here's a quick guide for building a basic scheduler with a few features. 1.Have two buttons start scheduler and stop scheduler and a drop down allowing set time in mins for example 90 mins.2.have the start button create a thread with a loop with a var. the var should also be set to true on the start button being pressed.3.after each loop check if its time to execute task.4.you can let the user choose which task to complete by having checkboxes. if you want to execute at a specific time then you would need the datetime plugin and just compare time at each loop instead.I've created a basic example hope this helps. thankskev123 Quote Link to post Share on other sites
Learjet 27 Posted April 1, 2016 Author Report Share Posted April 1, 2016 Wow, this is more than I was hoping for, thanks so much kev, I'll be checking it out here in a few minutes :-) Thanks again my friend! Peace,LJ Quote Link to post Share on other sites
deliter 203 Posted April 8, 2016 Report Share Posted April 8, 2016 I made an alright scheduler a while ago,complete with calendar,and timeslots,wasn't 100% complete,had a few beers in me during Christmas so I am sure theres some mistakes ,just took it off of some jquery site and added some code to integrate to ubot,though I wish I knew the run.Ubotscript command back then! anyways It was near completed so wouldn't take much to get it working fully,here somewhere on the forum http://network.ubotstudio.com/forum/index.php/topic/18528-basic-scheduler-for-ubot-4/?hl=scheduler Quote Link to post Share on other sites
Kreatus (Ubot Ninja) 422 Posted April 8, 2016 Report Share Posted April 8, 2016 This is a good suggestion for plugin developers out there. 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.