jorgeng Posted September 2, 2010 Posted September 2, 2010 I want to do one thing if clock is before 17.25 and another thing if it is after 17.25. I have tried this but this hour minute is complex, can be wrong. The problem is that 09 is true every hour and minute 25 true in 1-24, so how to check if clock is before 17.25? #include <Date.au3> If @HOUR >= 09 And @MIN < 25 Then If @HOUR < 18 And @MIN < 25 Then MsgBox(0, "Check","Check ok",5) EndIf Endif
enaiman Posted September 2, 2010 Posted September 2, 2010 If clock is 17:24 do one thing, if it is 17:26 do the next. If that is not precise enough for you (1 minute error) then check for 17:24:55 and 17:25:05 to do what you need. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
jorgeng Posted September 2, 2010 Author Posted September 2, 2010 If clock is 17:24 do one thing, if it is 17:26 do the next.If that is not precise enough for you (1 minute error) then check for 17:24:55 and 17:25:05 to do what you need.Ok, but the problem is that i need to have 17.24 in one string to calculate with.>09 is true at 10, 11, 12 and so on<25 is true at 1,2,3 and so on to 24.
enaiman Posted September 2, 2010 Posted September 2, 2010 You tend to forget that an equal sign exists If @HOUR = 17 And @MIN = 24 And @SEC >40 And @SEC < 50 Then SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
omikron48 Posted September 2, 2010 Posted September 2, 2010 (edited) If @HOUR = 17 Then If @MIN < 25 Then ;do something Else ;do something else EndIf EndIf EDIT: Is it supposed to not do anything if it's precisely 17:25? Edited September 2, 2010 by omikron48
jorgeng Posted September 2, 2010 Author Posted September 2, 2010 (edited) If @HOUR = 17 Then If @MIN < 25 Then ;do something Else ;do something else EndIf EndIf EDIT: Is it supposed to not do anything if it's precisely 17:25? I want to write some text to a file if clock is after 09.00 and before 17.25. At 17.25 i don't want to write to the file. I think your solution is good meaning that if clock is 17 and minute is less than 25 i can put up a message box. How to do between 09 and 17.24 writing to file in your code? Edited September 2, 2010 by jorgeng
omikron48 Posted September 2, 2010 Posted September 2, 2010 Your statement is ambiguous. Do you mean the time range is 0900 to 1724? or 1709 to 1724? Can you make a clear outline of your program logic with precise details on the parameters involved?
jorgeng Posted September 2, 2010 Author Posted September 2, 2010 Your statement is ambiguous. Do you mean the time range is 0900 to 1724? or 1709 to 1724?Can you make a clear outline of your program logic with precise details on the parameters involved?In time-range 0900 to 1724 i want to write data to a fileIn time-range 1725 to 2355 i want to have a message box
omikron48 Posted September 2, 2010 Posted September 2, 2010 (edited) You just need to break it down to sets of qualifying conditions. The trick is trying to find out the optimal conditions that will cover your requirements with the least amount of comparisons. If (@HOUR > 8 And @HOUR < 17) Or (@HOUR = 17 And @MIN < 25) Then ;write data EndIf If (@HOUR > 17 And @HOUR < 23) Or (@HOUR = 17 And @MIN > 24) Or (@HOUR = 23 And @MIN < 56) Then ;show message box EndIf @HOUR > 8 And @HOUR < 17 -> 0900 to 1659 @HOUR = 17 And @MIN < 25 -> 1700 to 1724 @HOUR = 17 And @MIN > 24 -> 1725 to 1759 @HOUR > 17 And @HOUR < 23 -> 1800 to 2259 @HOUR = 23 And @MIN < 56 -> 2300 to 2355 Edited September 2, 2010 by omikron48
jorgeng Posted September 2, 2010 Author Posted September 2, 2010 You just need to break it down to sets of qualifying conditions. The trick is trying to find out the optimal conditions that will cover your requirements with the least amount of comparisons. If (@HOUR > 8 And @HOUR < 17) Or (@HOUR = 17 And @MIN < 25) Then ;write data EndIf If (@HOUR > 17 And @HOUR < 23) Or (@HOUR = 17 And @MIN > 24) Or (@HOUR = 23 And @MIN < 56) Then ;show message box EndIf @HOUR > 8 And @HOUR < 17 -> 0900 to 1659 @HOUR = 17 And @MIN < 25 -> 1700 to 1724 @HOUR = 17 And @MIN > 24 -> 1725 to 1759 @HOUR > 17 And @HOUR < 23 -> 1800 to 2259 @HOUR = 23 And @MIN < 56 -> 2300 to 2355 Thank you. You saved my day..
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