Jump to content
UBot Underground

All In One Scheduler?


Recommended Posts

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

Link to post
Share on other sites

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

Link to post
Share on other sites

Thanks for the response Kev, I can leave it open, most of the things that I code are pretty lightweight.

 

Thanks again!

 

Peace,

LJ

Link to post
Share on other sites
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.

 

thanks

kev123

Link to post
Share on other sites

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

Link to post
Share on other sites

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

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...