QA Graphic

Date Conditions with Macros

Use Keyboard Maestro to add a condition to display different text per day

One thing that makes Keyboard Maestro a productive tool is the ability to add conditions to Macros. Keyboard Maestro describes the Conditional If-Then-Else Statement:

The If Then Else action allows you to choose which of two sets of actions should execute. If certain conditions are met then execute one list of actions. If not, execute another. If there are no conditions set then no actions will execute.

Having the If-Then-Else feature, I can display a different text output based on the day of the week that I call the Macro.

Perhaps this situation will be helpful:

When testing tickets I need to add a comment in Atlassian Jira that the issue pass testing. I use Keyboard Maestro as my text template. When testing on Wednesday, I am validating issues that are on the staging server but there's no tag - yet. Only issues tested on Thursday will have a tag, and my comment should reflect that tag.

Using a single Macro with a date condition, I can just type one trigger and the correct text will appear based on the time of day/week that I execute it. This makes it easy to remember one macro for similar actions.

Here's an example of the Macro that I have set up:

Keyboard Maestro Condition Macro

Some Notes

The %ICUDateTime%e% outputs the day of the week (1-7). When the day is 5 or greater, than the condition is true and the first statement gets executed. Otherwise show the second statement. Get the full details of all the ICU Date Time functions.

You can see the condition statement is being evaluated in Keyboard Maestro. See the currently false at the top of the If statement. This is helpful to know if your condition is really working.

The Text format in the "Insert Text by typing" field is formatted for Jira.

You can have any type of condition, check for application, mounted volume, clipboard content and so much more!

 

About

These posts showcase some excellent examples of why Keyboard Maestro is a must-have for every Mac OS user. As a powerful automation tool, Keyboard Maestro helps boost productivity, save time, and streamline repetitive tasks. With its vast array of customizable features and functions, it's the perfect choice for Mac OS users seeking to optimize their workflow.

Schedule

FridayMacintosh
SaturdayInternet Tools
SundayOpen Topic
Monday Media Monday
TuesdayQA
WednesdayKeyboard Maestro
ThursdayGluten Free