ViRa wrote:
Code: Select all
If((DAY(TODAY)<>11) & (TIME)@<>'14:01');
ChoreQuit;
Endif;
Now to the reason that this doesn't work, and why "negative conditions" can sometimes blind you to the reason:
The If() condition has to be either True or False as a whole. Because you've used an AND operator, for the entire IF() condition to be True,
both of the sub-components must also be True.
Most days (DAY(TODAY)<>11) will be True. But here's the first gotcha; on
every day of the month there will be one minute, specifically 14:01, where (TIME)@<>'14:01' will be
False. As a result the expression as a whole will be False and the ChoreQuit will not be executed. In other words, that condition will actually have the chore continuing each day at 14:01, assuming that you had it on a 1 minute cycle and that the start of it wasn't delayed by another process.
The reverse occurs on the 11th. (DAY(TODAY)<>11) will
always evaluate to False on that day, therefore the
entire expression evaluates to False (remembering that for it to be True,
both components must be True), therefore the ChoreQuit command will never be executed on the 11th. Consequently the chore continues to run, regardless of what the time is.
To have it work, and remember that I'm merely talking about the logic here, not recommending that you do this), you would need to break it out into two separate tests; one to test for the day, and then one to test for the time on the prescribed days. Like so:
Code: Select all
If( DAY(TODAY)<>11);
#Quit if the day is not the 11th.
AsciiOutput('F:\Temp\TimeExample.txt','Quitting Condition 1', TIME);
ChoreQuit;
ElseIf( TIME@<>'14:01');
# If this block is reached the day must be the 11th.
# Therefore we test for the time only.
AsciiOutput('F:\Temp\TimeExample.txt','Quitting Condition 2', TIME);
ChoreQuit;
Endif;
AsciiOutput('F:\Temp\TimeExample.txt','Continuing', TIME);