PcExpert Posted November 3, 2007 Share Posted November 3, 2007 (edited) 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 ThenMsgBox(64, "TEST", "Its not 17 o'clock yet")ElseMsgBox(64, "TEST", "Its 17 o 'clock")EndIfBut then I get a script error. Thanks! Edited November 3, 2007 by PcExpert Link to comment Share on other sites More sharing options...
Nahuel Posted November 3, 2007 Share Posted November 3, 2007 (edited) 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 November 3, 2007 by Nahuel Link to comment Share on other sites More sharing options...
PerryRaptor Posted November 3, 2007 Share Posted November 3, 2007 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 More sharing options...
PcExpert Posted November 3, 2007 Author Share Posted November 3, 2007 Thanks it works now! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 3, 2007 Moderators Share Posted November 3, 2007 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 More sharing options...
Nahuel Posted November 3, 2007 Share Posted November 3, 2007 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 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 3, 2007 Moderators Share Posted November 3, 2007 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now