Jump to content

smaller or bigger


 Share

Recommended Posts

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

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

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")
Link to comment
Share on other sites

  • Moderators
<_< 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.

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...