![QA Graphic](https://www.cryan.com/b_img/KeyboardMaestro2024.jpg)
Display Month Name
Quickly type out any month name
Boost your typing efficiency with Keyboard Maestro! No more wasting time spelling out month names. This handy macro automatically inserts the current month's full name whenever you activate it.
Here's my Display Month Name Macro:
Four Things To Note:
In this Macro, I use multiple shortcuts to execute the same Macro. 1 through 12 -> I type in the m. and then the month that I want to display and then a space.
The Macro set the Trigger value (m.6) to a variable, then GREP the Trigger name for the month. So I just get the number.
Then I use UNIX date/time command to get the full month name. (You may notice that 2017 in the year, that doesn't matter.)
The resulting text is typed out.
In Summary
I can easily change the month name format by changing the last command and it will impact all the macro shortcuts - no need to repeat the tast multiple time.
Keyboard Maestro offers a wide range of automation tools to streamline your workflow. This is just a small example of its capabilities. Explore Keyboard Maestro to discover how it can save you time and effort on repetitive tasks.
PermalinkMultiple Words List (Python)
Sample Shell Script in Keyboard Maestro
As part of my testing process, I occasionally require a list of words. To facilitate this, I developed a Keyboard Maestro macro that generates a list of 10 random words. Previously, I had crafted a similar script in PHP, but I've recently updated it to Python 3.
While I didn't observe any performance enhancements between the PHP and Python shell scripts, I did notice a quicker display of results when utilizing the 'Paste Results' feature.
Sample Macro
Python Code
#!/usr/bin/python3
import random
# Open the file with read permission
with open("/usr/share/dict/words", "r") as file:
words = file.readlines()
words_length = len(words)
def random_word():
# Choose a random word from the list
rand_word = random.choice(words).strip()
# Remove possessive case and capitalize the word
description = rand_word.replace("'s", "")
return description.capitalize()
# Generate and print 10 pairs of random words
for _ in range(11):
print(random_word(), random_word())
One More Thing
You'll notice that I have two different shortcuts assigned to this macro. This is a neat feature of Keyboard Maestro. You can assign multiple shortcuts to perform the same action. Useful when you may know the shortcut as different things in different projects.
Next week, I'll show you a cool way to take advantage of using multiple shortcuts for the same macro.
PermalinkParse Domain in URL
Sample Parse Functionality in Keyboard Maestro
This is a "basic" macro in Keyboard Maestro to split the URL of a new copy text in the Clipboard. This piece of code demonstrates that you don't have to trigger an action in Keyboard Maestro.
In this example the macro is triggered when a URL is pasted in the clipboard. Keyboard Maestro automatically parses the Domain name in the background.
You can change this up to create a hyperlink to this URL or strip everything to the right of the domain name and creates a new entry on the clipboard.
PermalinkAtlassian Comment Field
Quickly add an Emoji to your Comments
In 2019, Jira switched from MediaWiki to Markdown, removing shortcuts for the green checkmark and red X emojis. (See my old Jira new Comment Field) for details - Created March 18, 2019. )
Recently, Atlassian added an emoji picker shortcut. Type ":" and scroll down to choose the emoji. Frequently used emojis appear at the top for easy access.
I created a simple Keyboard Maestro macro to insert the checkmark emoji and add text to Jira comments, making it easy to indicate feature validation.
Example in Action:
Keyboard Maestro Macro
This is a screen shot of the Macro:
The pause for 1 second is needed because the macro runs much quicker than Jira's response.
PermalinkMacro Wizard
Quickly Create Macros that You Need
Keyboard Maestro now offers a streamlined tool for creating macros, making it easier for users to automate tasks quickly. This intuitive interface simplifies the process without sacrificing the power Keyboard Maestro is known for.
Five Things I Learned
Macro Wizard was introduced in version 11.
To activate the Wizard select the File menu and then "New Macro Wizard." You can also use the keyboard command: Option Shift Command N
Guide to show you the Keyboard Shortcut needed to trigger the new Wizard.
The Macro Wizard is a quick way to jump start a new macro, especially if you just want to add a basic shortcut. It really helps reduce the number of steps. For example, if you wanted to add a shortcut #Miss for Mississippi, using the Wizard makes this easy to add.
The seven action items are: Activate an application, Open a file, Manipulate a window, Paste some text, Type some text, Select a Menu, and Add Later. These were likely selected as the most common action items people use. Once the wizard closes you still have access to the 100s more in the Actions selector.
After you click on the "Create" button. You are presented with the regular Macro section ready for all your creativity - or to paste in the text you wish.
Try it out!
Keyboard Maestro veterans will definitely appreciate the new macro creation tool. It streamlines a process they're already familiar with, boosting their efficiency. But that doesn't mean it's exclusive to them. Even for those who are absolute masters at crafting macros, this new interface can provide a welcome alternative approach, potentially even sparking new ideas for automation workflows.
PermalinkPrompt For Snippet
Keyboard Maestro 11 elevates automation to a new level with its ability to prompt users for specific actions. This proves particularly valuable for streamlining repetitive tasks. Take my website screenshot macros, for example. Previously, I needed separate status menu items for each macro. Now, Keyboard Maestro 11 allows me to consolidate them into a single, user-friendly menu item. The user is then prompted to choose the specific website screenshot they require, eliminating menu clutter and enhancing efficiency.
Here's an example of the prompt:
This is what some of the macro looks like:
Three Key things to Remember
The variable %PromptButton% has the value of what button was selected.
Keep the information and options short, don't overload the prompt with a lot of buttons and text fields. You may find that there are better options to do what your trying to do.
I find using the prompt option on macros that are triggered by the status menu.
One More Thing
Keyboard Maestro's "Prompt for Snippet" feature was a game-changer for me, justifying the upgrade to the latest version. It streamlines my workflow by allowing me to create custom text snippets on the fly. Imagine having dynamic keyboard shortcuts that prompt you for specific details before inserting the final text. This eliminates repetitive typing and lets you focus on what matters - getting things done!
PermalinkShuffle Filter System Clipboard
Add Shuffle to your Clipboard Content
One of the neat things about Keyboard Maestro is the Clipboard History. You can easily activate the Clipboard History Switcher and get back any content that was put in the clipboard. By default Keyboard Maestro will hold the last 200 items in the Clipboard History.
Additional Filters
Along with copy/pasting previous items, you can apply some filters to the text in the clipboard history. There are 21 filters included with every Keyboard Maestro installation:
- Capitalize
- Display as Text
- Flip Horizontal
- Flip Vertical
- Font Awesome
- Half Size Image
- Lowercase
- Lowercase First
- Lowercase then Capitalize
- Lowercase then Title Case
- Move to Extra Clipboard
- OCR Image
- Remove Styles
- Rotate 180??
- Rotate Clockwise
- Rotate Counter-clockwise
- Set DPI to Nominal
- Title Case
- Translate
- Uppercase
- Uppercase First
When you apply a filter they don't happen immediately. A new clipboard entry is created and you can paste the content in. This way you can still get the previous clipboard item for future action.
Shuffle Time
New in version 10 is the Shuffle filter. Now you can easily shuffle the contents of the clipboard. This is useful when you have a list of names that you want to shuffle.
You can find all the details on how to add a new Clipboard Filter Trigger on the Keyboard Maestro Wiki.
Example Macro
Backup USB items
Use Keyboard Maestro to auto backup USB drive
This week's is a followup to the "Keyboard Maestro Copy File" blog post. In this week's post, I'll show you how to use Keyboard Maestro's actions to perform the same BASH function.
This is a great example of understanding the power that Keyboard Maestro has. While the BASH code is shorter in code, I feel the Keyboard Maestro version is more flexible in doing other actions.
Simple Task
Create a Macro that will copy all the documents in a particular folder and place a copy of them in a new location based on their created date.
Actions used
- Get File Name to Variable
- Get File Type to Variable
- If All Conditions Met Execute Actions
- Get Date Created to Variable
- Set Variable to Text
- Create New Folder
- Copy File
Keyboard Maestro Macro
These are the steps in the screenshot:
- Pause for 1.5 Seconds - Wait for the USB drive to fully mount.
- For Each Item in a Collection - For all the files in a particular directory on the Sony Recorder execute the following actions.
- Get File Name to Variable - Save the file name to a variable to be used later.
- Get File Type to Variable = Identify the type of file in this loop cycle.
- If All Conditions Met Execute Actions - Now lets take actions only on files and not folders
- Get Date Created to Variable - Get the file created date and assign it to a variable
- Set variable to Text - Assign the date format to a human readable format. (Example YYYY-MM-dd)
- If All Conditions Meet Actions - Check to see if the directory exists.
- Create New Folder - Create a new folder if it doesn't exists.
- If All Conditions Meet Actions - Check to see if the file already got moved over.
- Copy File = Move the selected file to the directory
Keyboard Maestro Copy File
Quick way to copy files from a USB device
Last Summer I purchased a Sony IC Recorder (ICD-UX570). Its a powerful audio recorder that saves files on the internal drive or the microSD expansion.
In order to download the audio from the recorder, I need to connect the device to the computer and drag the files from the device to my hard drive.
I decided to create a Keyboard Maestro Macro that would do that process automatically.
The Task
The task of this macro:
When the device is inserted into the computer, copy the files from the Internal 4GB memory to the ~/Music/Sony/ folder. Each audio should be in a folder with the date the recording was made.
Keyboard Maestro Macro
This is the Macro that I came up with:
Now when I insert the Sony Recorder, the files automatically get copied. I don't have to think about it. I can still move the files if I want, but I am guaranteed that a backup copy was made to the computer.
Bash Code
#!/bin/bash cd /Volumes/IC RECORDER/REC_FILE/FOLDER01 for f in *; do dir="/Users/cryan/Music/Sony/"$(stat -f%SB -t%Y-%m-%d "$f") # echo $f '->' $dir [ -d "$dir" ] || mkdir "$dir" cp "$f" "$dir"/ done
Some Notes
This was a quick fix, using BASH. There is a better way to do this in Keyboard Maestro using a lot of the built-in actions. Next week I'll show you the "official" way to do this using Keyboard Maestro
The "pause" is needed because Keyboard Maestro works immediately when the device is connected - the file system doesn't even see it yet.
PermalinkTime Zone Convert
Easy way to convert a time to different time zones.
This past week I was scheduling a meeting with a counterpart in California. I was looking for an easy way to let them know the time of the meeting using Slack. I thought there would be some plug in to automatically display a time in EDT to other timezones.
There isn't a Slack tool. Instead of giving up, I decided to make a quick action in Keyboard Maestro.
TimeZone Convert Action
This macro is triggered via the status menu - since it's something that I don't use all the time. When I select the entry, a dialog box opens up and asks me to select the meeting time.
After I click 'OK' the output of the Macro will be sent to the clipboard.
Dialog Box
After clicking 'ok' the following data is in the clipboard:
The meeting is at 4:00 PM EDT / 3:00 PM CDT / 1:00 PM PST
I can paste the clipboard data in Slack, Email, Facebook, or anyplace I need.
Keyboard Maestro Macro
This is what my macro looks like in Keyboard Maestro. I used the "Prompt for User Input" and "Execute Shell Script" actions.
Python Shell Code
Provided here so you don't have to type in the information in the above screenshot
#!/usr/bin/env /usr/bin/python3 import datetime import os from datetime import datetime as dt, timedelta from dateutil import relativedelta kmTime=int(os.environ['KMVAR_Time']) dt_object = dt.fromtimestamp(kmTime) est = dt_object + relativedelta.relativedelta(); pst = dt_object + relativedelta.relativedelta(hours=-3); cst = dt_object + relativedelta.relativedelta(hours=-1); print(f'The meeting is at {est.strftime("%-I:%M %p")} EDT / {cst.strftime("%-I:%M %p")} CDT / {pst.strftime("%-I:%M %p")} PST')
Some Notes
I used Python instead of the built-in ICUDateTime function because it was a bit complicated to pass through a variable to the ICUDateTime function.
This Python shell script is a good example of how to pass Keyboard Maestro variables to Python.
I am sure the Python code could be cleaned up - just thought I share it in the basic form.
PermalinkAbout
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.
Check out all the blog posts.
Schedule
Monday | Media Monday |
Tuesday | QA |
Wednesday | New England |
Thursday | Gluten Free |
Friday | Macintosh |
Saturday | Internet Tools |
Sunday | Open Topic |
Other Posts
- Keyboard Maestro Browser Version
- Reset Clipboard History in Keyboard Maestro
- Simple Date Calculation
- Keyboard Maestro Keyboard Shortcut Enhancer
- Milliseconds to Seconds Converter
- Keyboard Maestro Macro Library
- Keyboard Maestro Global Macro Palette
- MultiMarkdown Utility
- Keyboard Maestro and LaunchBar Clipboard Management
- Adding Keyboard Short to hide Firefox Bookmark Bar
- Atlassian Comment Field
- Smart Groups in Keyboard Maestro
- Parse Domain in URL
- Date Conditions with Macros
- Evernote Cleanup Macro