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.


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.