Jump to content

Reading time


jorgeng
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

;)

Link to comment
Share on other sites

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

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 file

In time-range 1725 to 2355 i want to have a message box

;)

Link to comment
Share on other sites

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

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..

;)

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...