And if you'll note the condition is currently saying "currently false" and the reason for that may be the same issue you have - the macro has not been run! So the actual current value of Today is (as shown in the action) "2016-07-26" which is not a legitimate number, hence the calculation is invalid. But if I select Try on the first action, then the second one now has a valid, true calculation and changes to "currently true".
Thanks all! I was trying to make this a macro that could run yearly, thus the “0725” instead of using the entire date.
It's kind of a silly experiment, but the whole story is, we have an old Mac Mini that does nothing but play music for our telephone hold system. I wanted to set it so it plays certain playlists during certain times of the year (e.g. Holiday music during the holidays).
The whole idea was to automate everything so no one would ever have to touch it. So I turned the Year into a variable.
Then I tried a few combinations of what @ccstone and @peternlewis suggested but still can't get it to work.
Here, I tried to incorporate a dateTest but it seems to act as an "OR" test than an "AND" test. That is, if Today is greater than the start date OR less than the end date, it's true. But I want it as an "AND".
Then I tried it as a direct calculation, but it keeps coming up false no matter what I set the start and end dates to.
Oops, on “Then I tried it as a direct calculation, but it keeps coming up false no matter what I set the start and end dates to.” I should say that it keeps coming up True…
What I demonstrated would work equally well without the year. Just remove the yyyy from the first action, and the 2016 (twice) from the second action.
Your action appears correct to me, and yet is showing “currently false”. My guess is that you have other characters in the calculation field that are not visible in the image. Try widening the display, or alternatively, post the actual actions (see How export a macro as an image without starting a new post?).
“A < B < C” (like you show in your second example) is not what you expect. It does not mean “A < B AND B < C”. “A < B” returns 0 or 1, and then it will test 0 or 1 < C, which in this case will always be true for “< 20161201”.
Ok, I got it. Thanks Peter! (I think I was having trouble because I'm using an older version of Keyboard Maestro on that Mac...version 5. Maybe the "AND" in calculations doesn't work back then? Sorry, I should've mentioned version number earlier.
Just for reference, here's an animated GIF showing why/how it's not working:
AND works in the older version, the problem is that the older version is not smart enough to figure out that "Today AND Today" is not a variable (since it is a legitimate variable name).
The newer version is.
In the older version, use brackets to ensure correct parsing.