Jump to content
Sign in to follow this  
PcExpert

smaller or bigger

Recommended Posts

PcExpert

Hi all,

I know it sounds like a stupid question but I couldnt find the answer in the docs. How to let the script determine if its later or earlier than a specified time?

I tried this:

If @HOUR = <17 Then

MsgBox(64, "TEST", "Its not 17 o'clock yet")

Else

MsgBox(64, "TEST", "Its 17 o 'clock")

EndIf

But then I get a script error.

Thanks!

Edited by PcExpert

Share this post


Link to post
Share on other sites
Nahuel

What error? The only problem with that is that it will tell you "Its 17 o 'clock" when it's actually 18. If @HOUR = <17 should be just If @HOUR<17

-edit-

I don't have AutoIt in this computer, but I think it's <=not =<. That must be the error you are getting.

-edit2-

Look at _DateDiff()

Edited by Nahuel

Share this post


Link to post
Share on other sites
PerryRaptor

Here you go...

$TimeSet = 10

If @HOUR < $TimeSet Then MsgBox(64, "TEST", "Its not " & $TimeSet & " o'clock yet")
IF @HOUR > $TimeSet Then MsgBox(64, "TEST", "Its after " & $TimeSet & " o'clock")
IF @HOUR = $TimeSet Then MsgBox(64, "TEST", "Its " & $TimeSet & " o'clock")

Share this post


Link to post
Share on other sites
PcExpert

Thanks it works now!

Share this post


Link to post
Share on other sites
SmOke_N
<_< I was under the impression that @HOUR/@MIN/@SEC all returned strings, and all of you are treating it as if it were an integer.
If IsString(@HOUR) Then MsgBox(64, "Yep", "I'm a string!")

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
Nahuel

:) I was under the impression that @HOUR/@MIN/@SEC all returned strings, and all of you are treating it as if it were an integer.

If IsString(@HOUR) Then MsgBox(64, "Yep", "I'm a string!")
Really? I've worked with those macros as integers and it works just fine <_<

Share this post


Link to post
Share on other sites
SmOke_N

Really? I've worked with those macros as integers and it works just fine <_<

Does that mean you are doing it correctly just because it "seemed" to work out?

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

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  

×