QA Graphic
December 22, 2021

Shuffle 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

Shuffle Filter

Permalink
December 15, 2021

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

Sony Action Steps

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

Permalink
December 8, 2021

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:

Sony Audio File

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.

Permalink
December 1, 2021

Time 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

Meeting Time Dialog

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.

Time Zone Converter

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.

Permalink
February 26, 2019

Reset Clipboard History in Keyboard Maestro

Paste your content and rollback the clipboard using Keyboard Maestro

Keyboard Maestro gives users a couple of options when adding a macro - the content can be typed or pasted in. If there???s a lot of text to be inserted, pasting is the right way to go. Not only does the content get added faster, but there???s less chance of accidentally typing a key when the macro is being inserted.

The downside to pasting is that the pasted content is now the most recent data in the clipboard. (Which isn't good if you want to do multiple things with the clipboard content.)

Thankfully Keyboard Maestro has a clipboard management functionality and you can easily roll back in one simple step; "Set System Clipboard to Past"

Adding Clipboard History

After I paste a content, I add the "Set System Clipboard to Past" to ignore the content being pasted in the clipboard:

Keyword Maestro Clipboard History

The advantage of doing this is that I can still use the clipboard content in another Macro or have access to the original content.

In the above example, I am pasting in a random phrase that I have setup for testing. The clipboard get's reset after the content gets pasted.

Permalink
February 19, 2019

Hide Multiple Browsers Bookmarks

Using Keyboard Maestro it is easy to perform actions with multiple applications

Sometimes I like to showcase how a website looks in Chrome and Firefox. I usually hide the Bookmark bar so that it's less distraction to the screenshot.

I made this process easier by creating a Keyboard Maestro macro to hide both browser's bookmark toolbars at the same time.

Using Keyboard Maestro, I set up a Macro so that I could close both Chrome and Firefox Bookmarks at the same time.

Keyboard Maestro Macro

Cross Brosser Bookmarks

Some Notes on the Macro

I used a weird keyboard combination to open/close the bookmark bar. If I need to do this a lot, I'll change up the shortcut to something a bit more reasonable.

When I execute the command a second time, both bookmark toolbars are visible.

I can easily change this to support other browsers, such as Omni, Safari and Maxthon.

The commands execute almost simultaneously and it doesn't matter which browser I have currently focused.

Permalink
February 12, 2019

Adding Excel Date Shortcut Everywhere

Easily add Excel insert date in any application

If your a regular user of Excel you probably know the shortcut to add the current date to any field: Control ;

So, if your use to it, why not just make it a shortcut in any application.

Simple Shortcut

Here's is a simple way to add Excel 'Today's Date' feature using Keyboard Maestro.

Simple Date

Now when I need to add the date, I simply type in Control ;.

Advanced Technique

What if you need a different date format in different applications? For example, you may want to display today's date differently in Slack than in an Excel table.

There's a simple way to make this happen (This is what makes Keyboard Maestro a really cool application!) Simply put in a condition to check to see what is the current active application:

Advanced Date Maestro

I used PHP to do the formatting here because I wanted to add an English ordinal suffix (1st, 3rd)

I can add multiple applications checks by adding additional conditions to the statement. Which makes it easy to have a single action short cut to display different formats in applications.

Permalink
February 5, 2019

Keyboard Maestro Keyboard Shortcut Enhancer

Use Keyboard Maestro to match common short cuts between applications

If your switching back and forth between applications, it can be hard to remember certain keyboard shortcuts. Apple has a UI Guidelines which standardize many common tasks: Cut/Paste/ Hide Applications.

What's nice about Keyboard Maestro is you can define short cuts when the application don't have functionality to do so.

Case in Point: I navigate between Apple Mail and Microsoft Outlook a lot. I wanted to have one keyboard shortcut to insert HTML links - since it's a command that I use a lot. Outlook uses Control Command K and Apple uses Command K.

With Keyboard Maestro, I can now remember only one shortcut between applications:

Outlook Quick Key

The above macro is in a group that is available only for Microsoft Outlook. This way it doesn't get activated in other applications. Come to think of it, it might be a good shortcut for BBEdit insert Anchor action.

Permalink
August 28, 2018

Keyboard Maestro and LaunchBar Clipboard Management

Use both Keyboard Maestro and LaunchBar Clipboard Managers

Keyboard Maestro and LaunchBar have excellent activate clipboard history switcher. Having both of them enable allows you to get the best of both worlds when you need it.

Keyboard Maestro Advantage

  • You can keep the Clipboard History Switcher and mouse click what you need.
  • You can "pin" clipboard items so you won't loose them.
  • You can preview more of the images in the dialog box.

LaunchBar Advantage

  • Simple Interface, simply select the text and the dialog goes away.
  • Perfect for the quick clipboard history use.
  • ClipMerge - Press Command-C twice to merge the copied data with the latest clipboard content. Useful for list building.

Trick to have them Both Enabled

One trick to having multiple Clipboard management is to have a similar hotkey. This is the setup that I have for both:

  • Launch Bar: Command ∖
  • Keyboard Maestro: Shift Command ∖

Clipboard History Switcher
Settings in LaunchBar and in Keyboard Maestro.

This makes it easy to switch between the two functionalities and use the one that is perfect for me right now.

Permalink
August 21, 2018

AppleScript iTerm2

Creating a Macro for iTerm2

iTerm2 is a popular Terminal replacement for Apple???s Terminal application. It provides the ability to create profiles with unique text colors, window appearance and key mapping.

Here???s a simple Keyboard Maestro Macro to open a new Terminal Session from any application.

KM Postgres

AppleScript Code

tell application "iTerm"
set myString to "echo -ne "033]0;"Database Server"007"" set newWindow to (create window with profile "Postgres Server") tell current session of newWindow write text myString end tell end tell

Why Have This Macro?

This comes in handy when I want to open up iTerm2 and go to a specific site..I don't have to open up iTerm2 and then switch to the profile and then select the profile.

Permalink

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.

Check out all the blog posts.

Schedule

MondayMedia Monday
TuesdayQA
WednesdayNew England
ThursdayGluten Free
FridayMacintosh
SaturdayInternet Tools
SundayOpen Topic