Sign in to follow this  
Followers 0
AllSystemGo

Need to know the best way

5 posts in this topic

#1 ·  Posted (edited)

Ok I'm just trying to figure out something here... I have something that starts my script every 30 minutes. I need to put in my code something that's going to tell him to from 08:00:00 to 16:30:00 run else you don't do anything...

Basically I need to know how to compare time, like the current time with a given one.

Cheers M8

PS: Kinda like

$StartTime = "08:00:00"
$EndTime = "16:30:00"

IF _NowTime(5) > $StartTime or _NowTime(5) < $EndTime THEN

....

ELSE

Exit

ENDIF
Edited by AllSystemGo

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Basically I need to know how to compare time, like the current time with a given one.

Look at the chapter "Macro Reference - Time And Date". You can stick your own time and/or date together there (suggestion : @hour&":"&@min&":"&@sec), and compare with the string you showed us.

So, whats the problem (apart from not knowing that AutoIt has got an extensive Help available) ?

[edit]

:lmao: I did not really notice you allready named a command to retrieve the time : "_NowTime(...)". If you've got that, what than is the problem ? Did you try if it would work ? And if so, how did it not work ?

What you posted should work. Yes, you can compare those two time-strings as they are, as the letter "3" is lower than the letter "4", just as the value 3 is lower than the value 4. :ph34r:

Edited by BitRot

Share this post


Link to post
Share on other sites

Ok I'm just trying to figure out something here... I have something that starts my script every 30 minutes. I need to put in my code something that's going to tell him to from 08:00:00 to 16:30:00 run else you don't do anything...

Basically I need to know how to compare time, like the current time with a given one.

Cheers M8

PS: Kinda like

$StartTime = "08:00:00"
$EndTime = "16:30:00"

IF _NowTime(5) > $StartTime or _NowTime(5) < $EndTime THEN

....

ELSE

Exit

ENDIF
Try this

IF _TimeToTicks() >= _TimeToTicks("08","00","00") And _TimeToTicks() <= _TimeToTicks("16","30","00") THEN
    ;do something
ELSE
    ;do something else
    Exit
ENDIF

Ed

Share this post


Link to post
Share on other sites

Thxs to both of you guys. I really appreciate..

BTW BitRot not because I am asking a question that seem dumb to you thats mean that I didn't read the help section before posting!!! :lmao:

I'll try both of your suggestions!!!!

Cheers

Share this post


Link to post
Share on other sites

Thxs to both of you guys. I really appreciate..

You're welcome :ph34r:

BTW BitRot not because I am asking a question that seem dumb to you thats mean that I didn't read the help section before posting!!! :ph34r:

Yep, that was what I was thinking :lmao: If I was mistaken I appologize. :geek:

Please, next time just try it. That code was/is not harmfull in any way, so that should not hold you back.

And, to be honest, I still have absolutily no idea what your problem with that code actually was/is :)

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