6 Months In ⇢ What I Wish I Knew on Day 1 With Keyboard Maestro

6 months ago this coming Thursday, I downloaded Keyboard Maestro (hereafter I'll call it KM). I was very new to computer automation. I made some valuable mistakes and I made some mistakes you seriously should not make.

Here are a few bits of advice.

tl;dr:

  1. Ask dumb questions fast on this forum, especially right when you first start.
  2. Try Writing text to files or appending it to files as soon as possible if you are new to programming.
  3. Use the "For Each" Action in KM to make anything you want to do an order of magnitude more powerful.
  4. Use these hotkeys when editing macros: command+control+a, and command+r

longer version

Ask Stupid Questions in this forum ASAP: I didn't realize that the product is totally usable by complete computer beginners like me, and so, when I made stupid mistakes, I didn't dare ask them here. The cost of this was, two days after downloading KM, my macros all stopped working for me and I couldn't figure out why. I spent a few hours troubleshooting based on everything I could find on the forum and help docs and such to no avail. I then moved on, ignoring the program I'd just downloaded for 45 days while it nagged at the back of my mind every time I was doing something I knew I could automate with KM if I could get it working again, before finally posting, ashamed, to this forum that I just seriously couldn't get anything to work and needed help. And after that, I STILL waited about 40 additional days to read the response I'd gotten (which came VERY quickly), because I "was busy" and was actually afraid of seeing a response that was going to confirm for me that I was not capable of using the product, or something.

Well, when I finally read it, 3 things surprised me. 1) The creator of the program @peternlewis, had been the person who responded so quickly 2) his response was detailed, and did not make me feel stupid, and 3) walking through his steps actually worked, even though it took me an hour and a few tries to make work and I'd almost totally given up before succeeding, because my system was ever so slightly differently oriented than the steps he laid out. So, by Mid July, FULLY 4 months into my first 6 months of having KM downloaded, I had wasted ALL OF MY TIME because of being afraid of looking stupid.

Use "Write to File" Action and "Append to File" action today if you haven't yet: From my perspective as a non-programmer, "write to file" and "append to file" (the former will erase or write-over what is already in a file; the latter will add the new stuff to the bottom) functions in a lot of ways like "setting" a clipboard or a variable to some text, but gives me a more relatable sense of what all is going on, since files are familiar and easy for me to open, while clipboards and variables are kind of a new thing and hard to conceptualize.

Writing TONS of stuff to files for a while helped me conceptualize programming in general, and in the end, two months later, I'm able to comprehend that my concept of "files" is like a metaphor for the fact that information lives inside the computer in various places, and that a "Computer Program" is a thing where a human tells a computer WHERE to look for certain data, and then, as it reads that data, the computer often finds additional instructions about WHERE NEXT to do something, like look, or paste content. Files are a representation of location that my head can easily get around. Variables are also an abstraction of location, but they end up being handy in ways that files aren't -- like the fact that their names are shorter, and that they can be treated like calculators and "incremented" and such.

No matter what you are using this program for, once you understand that you can, for example, append the clipboard to a file every single time the clipboard changes without really impacting your computer's performance all that much, and then you can at anytime open up a folder containing all those files you've created (hell, put them on your desktop if you like! But maybe just put the folder containing them on your desktop if you like) which has 500 files in it with all the various changes you made to the clipboard by hitting "copy" for the last two days, it's a powerful and relatable way of realizing the kind of things you can do to send the information anywhere you want mid-macro. What if you wanted to start filtering the clipboard before writing it to a file? or, hey, instead of saving it to a file, maybe searching it for certain things every time it changes, and if the search is fruitful, saving just the stuff you found to a file called "Stuff Found" while dropping the rest of the data. ALL of these things are relatively simple to do because KM has functions for them. And once you start saving a bunch of things to files, one day you start to realize, ahhh, I only need this thing saved for a minute here. I will use a Variable. I will use a clipboard. I will filter the clipboard for just the stuff I want and add all Stuff in a list to the "Ultimate Stuff" Variable, and then I'll do "a bunch of repeated stuff" to every line in that variable later on... which brings me to:

Use the 'FOR EACH' action today: The For Each action is the easiest way to make a macro that multiples your existing functional macros by like 1000. Or 1400 for me, last night, while I slept. "For Each" takes all the "lines" in your variable, or your file, or whatever, and "Does Stuff" with them. I used to try to estimate how many times to repeat a task like "toggle down in this spreadsheet, copy, and then do something" 1400 times. Instead, I can copy the lines from that spreadsheet to my clipboard and use For Each: For each "line_or_whatever_I_want_to_call_it" in the "Clipboard" will set a variable called "line_or_whatever_I_want_to_call_it" that can run through a sequence, before setting the variable "line_or_whatever_I_want_to_call_it" to the NEXT line in the clipboard. Working through the sequence of STUFF to be done, "line_or_whatever_I_want_to_call_it" will always represent the next line in the original clipboard (note that if you keep copying and pasting as part of the sequence of STUFF, this won't impact your lineup of initial lines. The program reads that input and locks it down, like basically saying, okay, 1400 lines there in that variable, I'll call them 1, 2, 3 and 1399 and 1400.. and I'll do for each of those lines whatever this next part of the macro says to do... and then I'll move on). I use this to scrape textbook data. I want Parent URLS for textbooks, and then I want to know what the related textbooks are. So I scrape each page for all URLS on the page and save them as "children" of the initial parent. And then after running through 85 books, the next step in the macro actually copies all the scrapes children urls and does the same thing for each them line by line. This way I can easily serve up "related" stuff to professors using my application, just on the assumption that these websites already know which stuff is related to what stuff better than I do.

The "For Each" action was the largest breakthrough for me in comprehending the power of macros. Once you've used it, you'll start to see how you can add additional "Flow control," Like an if-then-else statement, to check each line for certain characteristics so that during the night when two of your 1400 lines have a typo in them, your whole macro doesn't fail, or worse, start writing random stuff to your mom in iMessages or whatever.

Use these two hotkeys when editing macros: command+control+a, and command+r: command+control+a took my fingers WEEKS to get used to but now its uber crucial. It brings up a super slick search bar where you can find any action KM offers. You can search by all kinds of terms and hit enter to select. Good stuff.

command+r toggles recording on and off. When you record, KM tracks all your actions. Don't try to record 100 steps; use this to record a couple steps, then hit command+r again to stop recording. Go back into Keyboard maestro and you'll see the actions you took. Think of command+r as a nice way of searching for actions, as you'll want to then totally edit what you've got by adding certain pauses and flow control and stuff, but it's all there in front of you. Like dumping the legos out on the ground to look through rather than attempting to remember the pieces you need without a visual.

I hope this was helpful to some new person in the situation I found myself in 6 months ago.

AND, FOR THE NEXT 6 MONTHS:
Well, it seems clear to me that I need to figure out how to do this stuff outside of the Visually Rendered Websites I'm Crawling. It occurs to me that just like "Files" were a nice map for my head of what is going on with data in my computer, "Websites" are nice maps for my head of what is going on with data on the internet. A simpler way exists of grabbing that data, parsing it for what I want, and saving it. I just have to go under the abstract layer of the visual internet. And for that, there are plenty of javascript code snippets online I can likely run inside of KM. Not totally sure, but I'm gonna start giving it a shot.

Beyond this, I know that copying data to my own locations is not ideal, and once I understand how and where to call for this data, I will be able to simply serve it up on the fly to customers from wherever it lives today; eventually maybe I want to do my own analysis of the data and may want my own database of record, but at current levels, I'm relying entirely on existing data structures that appear to have zero interest in throttling queries at my rate of probably 10 per minute, and it's a long way down the road before that reaches 1 per second; by then I am sure the same progression of my comprehension will lead to more reliance on APIs, or (since many of the old-school companies I am aggregating data from have business models that rely right now on obfuscating and controlling data) at least automated scraping and temporary display of the data. Kind of like moving in KM from files saved on my desktop to local variables...

Also, I want to get my old mac running KM in my garage 24/7 with macros being triggered remotely via the server setup, which I don't totally understand yet.

When I think about the fact that in my first 6 months I wasted 4, I'm thrilled to think that in another 6 months I have 3X the amount of actual time in this product before my 1 year mark. I'll likely have turned it into something exponentially more valuable then. I already feel like it's helped me catch back up a little bit to the increasing pace of change I see in technology, and opened my eyes to the real power of computers and the meaningfulness of building my own things in general instead of renting, leasing, and buying everything.

33 Likes

Excellent post!

+1. This is one of my favorite actions and incredibly useful once you wrap your brain around it. I only recently starting using For Each to reduce the clutter I'd written into my macros. I use Excel a lot for work, and combining For Each and Repeat lets me move both horizontally and vertically through a sheet in just a few actions. ie:

I only recently starting using this, as well, but I prefer to use it on Control+Space. I Spotlight everything I can, so I use Control+Space for Insert Action By Name, Option+Space for
MACRO: [KMFAM] Favorite Actions and Macros by @DanThomas, and Command+Space is of course Spotlight.

I use this to Call Insert Action By Name, because I try to avoid remapping default hotkeys when possible.

2 Likes

Go to System Preferences > Keyboard > Modifier Keys… and set your Caps Lock Key to ⌃ Control. Pretty comfortable then, and almost automatic. (Also for other shortcuts.)

1 Like

I setup a simple KM macro triggered by ^A to Add Actions.
Very comfortable, and makes it consistent across all my Macs.

1 Like

I’m somewhat habituated to the cursor movement keys, even in KM Editor text fields. (⌃A brings the cursor to the beginning of the line.)

Yeah, I guess it is all in what you are used to.
I use the standard Mac shortcuts for text processing, which ⌘← to go to the beginning of a line. I make extensive use of the Control key in many of my hotkeys/shortcuts.

Great post. I would have to add to it, that once you get the rest of the basics under your hat, be sure to learn regular expressions. Months ago I finally took a week to learn and experiment with them, and they have totally changed my whole automation game. They allow you to extract pieces of text based on set of rules, or run advanced find and replace commands. Many actions in KM let you take advantage of this powerful tool.

In the beginning, I was pretty confused about using them and would spend hours trying to modify a regular expression to work that I found on the Internet. But actually sitting down and learning them from scratch usually lets me condense what would have been 5 or even way more separate actions into one, and often more reliably.

http://regexr.com Was the tool that got me figuring this stuff out with their cheat sheets and example expressions. It is my go to tool for writing a regular expression so can see how it will behave before using it in KM.

8 Likes

Highly recommended hotkey set to learn right away:

3 Likes

yessir, I have set up a bunch of (all three + letter) macros for everything related to KM now, like T for Trigger macro by name, and also, I set up (all three) plus space bar to display a large quick map of the modifier symbols and what keys they actually are, since I'm really new to using those keys and can never keep them totally straight just by their symbols (except command).

so control option command space puts this over my screen for a few seconds:

5 Likes

Is this a UI you built or one of the included options? I use KeyCue and I also have Picture in Picture selected in Accessibility and I note it's coming up when I press CONTROL+OPTION+COMMAND. (new discovery!) so I may have to modify to use this choice. Explain a little deeper if you don't mind. :wink:

"Display Text Large". I had to look it up. Never saw a use for it - now I do!

1 Like

I found several options for display text in menus and the action list. Where is it?

“Display Text”, then it’s one of the options. I’m going to add a separate action for this using my KMFAM macros, so I don’t forget. :slight_smile:

1 Like

Ah! Ok. Got it. So is this an action, menu, or preference?

Action.

I suggest you to look into Karainber and sticky keys as I myself had trouble twisting and remembering all these hotkeys.

Being able to rebind everything yourself and have the modifier keys be right there on your keyboard letters is a really huge productivity boost. Plus there is a ton of freedom making the hotkeys work for you rather than against you. :smiley:

1 Like

Well done John!

I'm with Dan – I've rarely used Display Large Text – but this sort of application gives me a reason to rethink its value.

-Chris

1 Like

Great post and I’m in that first couple weeks of using KM but still quite unsure why or how to use it. I have some time this week so will try to figure some things out with your post, and I guess what I’ve learned is to ask questions of the forum or describe what I’m trying to do. Thank you for the post.

Welcome to Keyboard Maestro! It is the best Mac automation tool I have ever used.

However, you may be misled by its name.
KM suffers from a name ("Keyboard") that immediately causes the potential user/customer to think it is very limited, when in fact it is quite broad:

  • Text Expansion -- Provides extensive text expansion capability, from simple text substitution to complex snippet generation using scripts and user interaction
  • App Launcher -- from simple to complex (think of using @DanThomas' search macros)
  • Workflow Designer -- from a few simple steps to very complex, multi-macro, multi-scripts
    • Built-in integration with all Mac scripting languages
  • Web Page Control and Data Extraction -- From simple page display to auto-fill of online forms to scraping of data both visible to the user and hidden in the HTML code.
    • Built-in integration with access to and control of Safari and Google Chrome
  • Custom Web Applet (i.e. HTML Prompt)

If you, or anyone, has any questions about how to use KM for the above objectives, please feel free to ask.

Getting Started with Keyboard Maestro

  • Read the Quick Start.
    • This is essential to become familiar with KM terminology
  • Do the tutorial (Help ➤ Tutorial) in the KM Editor.
    • Gives you a live walkthrough of creating a macro in the KM Editor
  • Review/Browse the Available Macro Actions
  • For Help with an Action in your Macro, click on the gear icon at the top right of the Action, and select "Help"
  • Start small, and grow your macros organically.
  • Be prepared for some trial and error in the beginning.
  • Make good use of this Keyboard Maestro Forum
    • Search for existing macros
    • Post your questions/issues if you get stuck
2 Likes

@jdevaud For some (basic) examples of what @JMichaelTX has mentioned:

kind:folder.kmmacros (1.4 KB)

I use this macro to type kff which expands into kind:folder.
This lets me type kff dog in spotlight and get kind:folder dog, and jump straight to the folder with pictures of my dog, instead of every file with "dog" in the title or contents.

Launch Boom 2 w: Spotify.kmmacros (2.0 KB)
Quit Boom 2 w: Spotify.kmmacros (1.8 KB)

I use these two macros to automatically launch and quit Boom 2 whenever I launch or quit Spotify.

Paypal Partial Refund.kmmacros (2.9 KB)

I use this macro to avoid accidentally refunding an entire transaction through Paypal, instead of the partial refund I had intended.

There are better and more complex examples for each, but these are some very minor ones that make my life much easier/better. That Paypal one would've paid for Keyboard Maestro several times over if I had thought of it before needing it :unamused: :wink:

1 Like