Jump to content
Sign in to follow this  
Diana (Cda)

Time-aware script?

Recommended Posts

Diana (Cda)

Is there a way to word a script so that it runs only between, say, 5:00 a.m. to 9:00 a.m., or whatever times we designate?

Also, for a second script, that the times be limited but also limiting it to certain days or weekdays or weekend days?

Thanks! :)

Share this post


Link to post
Share on other sites
SmOke_N

Is there a way to word a script so that it runs only between, say, 5:00 a.m. to 9:00 a.m., or whatever times we designate?

Also, for a second script, that the times be limited but also limiting it to certain days or weekdays or weekend days?

Thanks! :)

There are plenty of _Date/Time functions in the help file... that and AdlibEnable() to check a function that checks those dates/days/time at a specific interval, should be all you need.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Diana (Cda)

There are plenty of _Date/Time functions in the help file... that and AdlibEnable() to check a function that checks those dates/days/time at a specific interval, should be all you need.

I'm sorry, do you have an actual example, by any chance, of something that will work to do this? It's becoming a pain to admit it but I look over the help file and find it quite difficult to work with. Granted, I don't seem to be a natural programmer; however, once I have a bit of code that works, thankfully I seem to be able to modify it fairly successfully. This is going to be pretty complex code, I have a feeling ... <sigh>

Thanks. :)

Share this post


Link to post
Share on other sites
weaponx

Do you want the script to be launched by task scheduler?

- or -

Do you want the script to run continuously?

If so you could do:

#include <Date.au3>

$startDateTime = "2007/09/18 9:00:00"
$endDateTime = "2007/09/18 9:38:00"

While 1

    While _DateDiff ( 's', $startDateTime, _NowCalc ()) > 0 AND  _DateDiff ( 's', $endDateTime, _NowCalc ()) < 0
        ;Insert code here
        MsgBox(0,"","Program Running")
    WEnd

WEnd

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.