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!

 

Comments

Add Comments

Name:
Comment:

 

About

These posts highlights some cool examples of why Keyboard Maestro should be part of every Mac OS user's computer. Keyboard Maestro is a powerful automation tool that can help improve productivity, save time, and streamline tedious tasks. It has a wide range of features and functions that can be customized to suit any user's needs, making it an ideal choice for Mac OS users.

Schedule

ThursdayPython
FridayMacintosh
SaturdayInternet Tools
SundayOpen Topic
Monday Media Monday
TuesdayQA
WednesdaySnagIt for QA