Sign in to follow this  
Followers 0
gertsolo

Timed actions

6 posts in this topic

Hey,

I haven't had too much time searching the forum so if someone could point me out in the right direction, that would be great.

For a website I want to upload stuff, but I want to do it at night when the costs and loads are lower.

basicly I want to do these things at certain times (when I am asleep ;-)

Something like : at 23:00 do 'some actions'

is this possible?

I'm even looking into the possibility to autostart my computer just before the point the actions have to be done (if that is possible ?)

thx & grtz


The more you learn, the less you know.

Share this post


Link to post
Share on other sites



Can you upload using ftp?

Share this post


Link to post
Share on other sites

Can you upload using ftp?

Yes, but is not just uploading. There are also other things I want to execute before the uploads.


The more you learn, the less you know.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You can schedule the execution of your app with Task Scheduler.

If that's not enough you can get the hour with Date functions and keep checking until a function has to be run.

About autostarting your PC, you should look at the motherboard BIOS and its manual.

Edited by TheGeneral

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

If that's not enough you can get the hour with Date functions and keep checking until a function has to be run.

that was my first idea, but I hoped there was a function for that, too bad...

Anyway I now do it like this:

While 1
  $time = @hour & ":" & @MIN & ":" & @SEC
  consolewrite ($time & @CR)
        if  $time = "16:17:00" Then
   MsgBox(4096, "time", $time)
  EndIf
  if  $time = "16:17:05" Then
   MsgBox(4096, "time", $time)
  EndIf
    WEnd

Problem with this is that I get several matches for that time. I mean that the while cycle goes faster that 1 second and thus the actions are performed several times. How can I prevent that and do just the action once?

I put in a sleep, but that's a bit dirty written, no?

Edited by gertsolo

The more you learn, the less you know.

Share this post


Link to post
Share on other sites

First, you should put in a sleep, so the while 1 loop doesn't eat all your CPU cycles. But if you put in, say, sleep(1000), then you might miss the time. A better approach would be to use "greater than" instead of "equal" for the time comparison, and set a variable indicating that it's done, so it doesn't repeat.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0