Category Archives: Keyboard Maestro

Planning your Keyboard Maestro macros and Text Expander Snippets

Difficulty Level: Advanced

Here’s a tip to take your Keyboard Maestro macros and Text Expander Snippets to the next level of productivity. With all the changes made to OS X and Apple’s programs, I find it best to plan your macros and snippets properly. One never knows what changes will come, so with a little extra work, you can safeguard your work from future changes.

The best solution is to break down your macros and snippets into smaller ones. For example:

Scenario 1:

Here’s an address snippet:

  • Mr. First Last
  • 123 Any Street
  • Anytown, Country
  • Postal Code

Scenario 2:

  • ,,name
  • ,,addressHome
  • ,,CityHome
  • ,,PostalHome

I prefer Scenario 2 because if I ever have to change one line, I can do so by changing the snippet for that specific line rather than having to change the snippet in Scenario 1 and any other snippet that may have that same line. It really comes in handy when you use snippets in many different places.

The same applies to Keyboard Maestro, perhaps more so.

I have macros that apply formatting to text. I give it its own macro and call upon it by using the ‘Trigger Macro by Name’ macro. If, for whatever reason, I need to change the formatting, I can do so from one location rather than every single macro that contains it. This form of compartmentalizing makes changing things so much easier in the long run and will save you many headaches later. Especially when Apple decides to make some smaller changes.

The drawback is you will create a massive list of macros; organizing and finding them later will be a challenge. What I do is have a different Group for these subordinate macros and snippets and name them something like ‘<blank>Helpers’. I use a descriptive name to make finding them later pretty easy.

Try it out. I’m sure it will save you time later. Have fun.

 

Get a URL while you type with Keyboard Maestro

Difficulty: Basic

Don’t you hate having to switch between your text editor and your web browser to get a URL? Although the process is straightforward, it’s annoying and boring.

  • switch applications
  • highlight the URL
  • copy
  • switch back to your text editor
  • paste

Here’s a Keyboard Maestro macro that makes the entire process simple and fun and it will work from any text editor.

Get a URL super quick
Get a URL super quick

I used Safari for this, but you can use whatever browser you like as long as you know the keyboard shortcut to highlight the URL bar.

  1. While you type, press the keyboard shortcut you created
  2. The macro will open Safari
  3. I placed a pause here in case your computer is slow
  4. ⌘L will highlight the URL bar
  5. ⌘C to copy it
  6. Activate Last Application will activate the last application you were using, i.e., your text editor
  7. ⌘V to paste

Easy! I hope you find it useful.

File Important Notes Quickly With Keyboard Maestro

Difficulty: Normal

Have you ever been working and wanted to remember something for later, but found switching applications tedious?

Here’s a fun Keyboard Maestro script that allows you to highlight text anywhere and have it saved to the file of your choosing for later processing. Your computer will speak to you and tell you the process is complete!

I started this macro with a User Prompt. It asks the user to choose which file you’d like to save the text to. Of course, you need to create these files, store them in one place. If you ever move them, you’ll have to change the path in your script.

Append Text to Chosen File
Append Text to Chosen File

You can create as many files as you want or you can skip this step entirely if you plan to save all your text to the same file.

Sorting Where the Text Will Be Saved
Sorting Where the Text Will Be Saved

Since I have placed a drop down menu in the user prompt, we will need an If Then Macro to sort the 2 options. If the user has chosen the ‘Notes’ file, then we proceed with this action:

  1. If the variable, ‘Choose File’ (created in the User Prompt) contains ‘Notes’, then store the highlighted text to a Clipboard I created named ‘Temporary’.
  2. Use the ‘Append Text to File’ macro,  and in the text area, simply add a return carriage by hitting the return key. This will ensure the highlighted text gets placed on its own line. Before moving on, make sure you choose the correct file path from the file path chooser.
  3. Use the ‘Append Named Clipboard ‘Temporary’ to File’ macro, choosing your file path once again.

There are some settings here; feel free to make any adjustments to your text. I prefer plain text for its portability.

Confirming the Text Was Saved
Confirming the Text Was Saved

Lastly, we have three macros to confirm it executed properly.

  1. We quit TextEdit (or whatever application you prefer) if it is open.
  2. The computer will now speak the words: “Text was appended to your Notes files”.
  3. Finally, we reopen TextEdit and the Notes file and see the result. You can remove this step once you see for yourself that indeed it worked for you. Note: we must close the file and reopen in order to see the results. The changes do not dynamically update themselves live. Although the changes were made, a refresh of the file will allow you to see them.

Lastly, we repeat the same steps again, and place them into the ‘otherwise execute the following options:’, or the ‘Else’ section of the Else If script step. However this time, you make a few small changes:

  • change the file path to the To Dos file you created
  • change the message the computer speaks from ‘Notes’ to ‘To Do’

Variations: As already mentioned, you can skip the whole If Then step, simplifying the process, but all your text goes to the same file. You could then duplicate this macro, change the file path and direct your text elsewhere; one keyboard shortcut for every file. You could also add a radio button to the User Prompt, asking whether this information is deemed important. Then you could add an If Then script step to apply a series of asterisks before the text is placed, in an effort to emphasize your notes later.

I hope you find this as useful as I do. With the addition of the ‘Speak Text’ macro, working on my Mac became even more fun.

Enjoy!

An If Then Else Macro with Keyboard Maestro

Difficulty: Normal

Do you find data entry as annoying and boring as I do? It doesn’t have to be that way. Try this Keyboard Maestro script to make those simple boring tasks more manageable and perhaps even fun.

Of course, you could apply this to any context, but I chose to use the example of entering a client’s contact information into a Pages document. (Actually, I prefer Apple’s Text Edit or any third party app capable of plain text editing, but that’s a topic for another post)

Although this isn’t a complicated script to write, there a many places where things can go wrong. I find this script is a springboard to bigger and better things. It incorporates an essential step, the If Then Else script step, which when mastered, can take your productivity as far as you want.

Let’s start with the User Prompt:

Setting Up the User Prompt
Setting Up the User Prompt

As always, you can tailor this to your needs: exercise routines, diet results, client info, DVD library, etc. You can get clarity on the Paid Status value here on a previous post.

The next step. You have the data, now you open your preferred text editor. I place pauses immediately after the computer needs to do some work or animation; we want the computer to finish this step before our next step triggers, so it’s important you get this right. Too long is better than too short a time span. Once it’s working perfectly, you can always fine tune the timing later.

In this example, I open Apple’s Pages app, use a keyboard shortcut to open a new file, and use the return keystroke to simulate clicking OK. This works fine for Pages, it may be too much for other text editors. In other words, you’ll need to make it fit:

Pages Related Macros

The next step is the data entry. Do not get intimidated here. You do not need to know this code-looking syntax. I enter the text ‘First Name: ‘ then click the disclosure triangle next to ‘Insert Token’, above the text box to the right. There you can hover over the first item on the list, ‘Variable’ and find the variables you named in the first step there. It will automatically insert this ‘code’ for you.

As a side note: I have so many variables, I sometimes click the wrong variable. Double check you’ve chosen the right one.

Then comes the If Then Else Script step. It’s actually very easy. The hardest part is deciding on the trigger. In this example, I use the value of ‘Paid Status’: if ‘Paid Status’ is true, do this… and if Paid Status is false, then do this…

Entering Text Macro

 

If everything went well, when you press your keyboard shortcut to activate this script, you should see the following:

 

empty user prompt
empty user prompt

Enter some text:

with the prompt filled out
with the prompt filled out

Then watch Keyboard Maestro‘s magic wand do it’s work!

What it should look like
What it should look like

Those most common misstep for me, other than the ones I mentioned, is proper formatting: sometimes there’s a carriage return or a space missing or a return where one isn’t needed. These are minor details. The most common problem I have is managing the pause length, but with a simple script like this, you shouldn’t have any problems.

Other options you can try:

  • take out the steps that open an app and trigger the script when you’re already in your preferred app
  • add more complicated variables
  • add calculations
  • create sentences with the user input and then print that to your document
  • this list is limitless

Have fun with this. I hope you create same really productive scripts.

 

Adding a Yes or No Checkbox with Keyboard Maestro

Difficulty Level: Easy

Have you ever wondered how to add a checkbox in Keyboard Maestro? Although it’s not apparent, it’s extremely easy.

With all the incredible features Keyboard Maestro has, implementing user input has brought my scripts and macros to an entirely new level.

Here’s how to do it:

2 ways to perform a yes or no
2 ways to perform a yes or no

The first option will create a checkbox. It works with a 0 as false and a 1 as true with | (found above your ENTER key, and known as the pipe symbol) as the separator. Another way to look at it is this:

  • 0 is equal to false and also equal to box unchecked, or
  • 1 is equal to true and also equal to box checked

The second will create a dropdown menu with the 2 values also separated by the | symbol. In this case you have Yes and No.

These values are stored in their respective variables. In this case, I have named them: ‘Yes’ and ‘Yes or No’, but you can call them anything you like.

Yes or No dialog box using Keyboard Maestro
Yes or No dialog box using Keyboard Maestro

Of course, these 2 options by themselves are almost useless. Adding a conditional Action like an ‘If Then Else’ after the ‘Prompt for User Input’ will make this extremely useful.

Have fun with this.

Fast Calculations with Keyboard Maestro

Difficulty Level: Basic

When I’m on the field taking notes, I use Apple’s Notes app on my iPhone 5. iCloud keeps my data on the phone and on the Mac in sync. It’s easy; it’s convenient. But it’s certainly not the prettiest.

But this post isn’t about note taking. It’s about accuracy and convenience. Often, I have many calculations to make. I’ve made mistakes in the past. Now, I still make mistakes, but not with my calculations.

Here’s what I used to do:

  • use the iPhone to take my notes on site
  • go to the office and open Notes on the Mac
  • with Notes open on the Mac, open the calculator on the iPhone
  • hope I tapped all the numbers correctly, get the value, and type them into the Notes app on the Mac

Very slow, boring and error-prone…

Here’s what I do now:

  • use the iPhone to take my notes on site
  • go to the office and open Notes on the Mac
  • highlight the calculation and hit a keyboard shortcut, and voilà, done!

Much faster, 100% accurate and fun…

Here’s how to do it:

Using Keyboard Maestro, you can call your macro whatever you prefer. For the hot key, I use the letter M because it’s short for Math. Whatever works to help you remember…

Keyboard Maestro Perform Calculation Script

For example, let’s say the calculation (the highlighted text) is:  239*57

  1. copy the highlighted text onto the system clipboard
  2. choose Filter Clipboard with Calculate, then Filter System Clipboard, with Calculate, which will simply calculate the highlighted text
  3. I type the Right Arrow which simply unhighlights the text and goes to the end of the text, ready for…
  4. the Return key, which sends it to the next line
  5. finally, I paste. The answer is already stored in the System Clipboard, so performing a routine paste will spit out the answer: 13623

You can easily modify steps 3-5 to your needs. You may not want to keep the original calculation; you may only need the answer. Tailor it to your needs. Apply formatting! Whatever you need. The end result will be accurate and fun to perform.