Run macro from another macro

How do I run a macro from another macro?
Tried “Type a keystroke” (a KM hotkey) but it doesn’t work.

Use the “Execute a Macro” action (from the Execute category).

Perfect. Many thanks.

FYI I had to search for 15 minutes for the answer to this question (glad I found it!) and found it confusing that this isn’t clear in the documentation nor the app. I sincerely expected to find this inside the Categories: Keyboard Maestro folder. Maybe it should be double-listed (once in Execute and once in the Keyboard Maestro folder).

Suggestion for a future update…

Hey David,

Please provide some examples of what you searched for that did NOT find it.

Thanks.

-Chris

I sincerely expected first to find it in the Category: Keyboard Maestro. Indeed, in there, I found similar (and confusingly named) ones like “Trigger Macro By Name” – which I thought would let me trigger another macro by specifying its name in the script.

After staring at all the options in Category: Keyboard Maestro, I then did a global search for “Run” (no good results), then “Trigger” (no good results), then "Start (no good results), then “Macro” and now I found confusing things like “Activate Macro Group” – I understand KM’s terminology of activating and deactivating, but in my mind, all I was wanting to do was run one macro.

(I see now that the option I wanted was there all along: “Execute a Macro” – but I didn’t see this at the time.)

I googled for “keyboard maestro run macro from another macro” and found lots of links to the KM documentation but none of them answered my question.

I know this is one of those things where I didn’t find something that was right under my nose, but if that helps you understand the thought process behind fifteen minutes of KM frustration that saves someone else, great.

I see now, and understand, that it makes sense to have it in the Execute category. But to me, it makes MORE sense to have it in the Keyboard Maestro category. (Or, if you’re willing to have duplicates, I’d put it in both.)

1 Like

I think the new Wiki is always a good place to start a search.

Starting with the simple word macro may lead to what you want here:

https://wiki.keyboardmaestro.com/Home_Page?do=search&id=macro

1 Like

Hey David,

Google is great, but it's best to start with the Keyboard Maestro documentation.

The most current docs are up on the wiki as @ComplexPoint mentioned.

I wanted to know how you failed, so I could add tags to the wiki.

In this case I added:

ExtraSearchTags: Run Macro, Run a Macro

Now if you search for "run macro" or "run a macro" WITH the quotes you'll find it right quick.

https://wiki.keyboardmaestro.com/Home_Page?do=search&id="run+macro"

Keep in mind too that pressing the Option-key makes help available directly from the insert token and insert function menus (and insert actions fairly soon).

Help is always available from an action emplaced in the KM editor from the contextual menu or from the tool-widget pop-up menu.

These help items take you directly to the relevant wiki page.

Keyboard Maestro is a very sophisticated automation utility, and it's natural for there to be a pretty sizable learning curve. I do understand the frustration of not being able to find what you're looking for — it's happened to me many times.

-Chris

Yep. Thanks for the tips!

I agree, I’m really impressed with the power and depth of KM. Also, it’s been rock-solid – no crashes. I’m recommending it to everyone I know.

That said, there are definitely some things about it that have been less than intuitive. Lots of things that are hidden beneath its surface that I just had no idea were there.

The web site is certainly sufficient and clean, but it’s also so deep. With no navigation at the top (as is usually the standard), the support options are more buried. Then when I go looking, I find documentation, forum, and wiki – three possible places to begin a search. Sometimes Google just seems simpler – even though I get what you’re saying.

I sure wish there were more YouTube demonstrations devoted to it. (I know I know, I just recommended a FOURTH avenue…) There are some things where it would be very helpful to see people demonstrate. I posted a private video to my community of professionals demonstrating how to automate an oft-used feature using KM, and instantly got you a handful of KM converts just from showing this narrow but highly useful macro in my line of work.

If it's not a secret let's see it.  :smile:

Who knows — you might inspire some more folks to make vids.

-Chris

1 Like

If you must see it, it’s unlisted on YouTube because I didn’t take the time to polish it:

(I like to only put polished videos as public.)

This was a quick-and-dirty demonstration of a simple technique in Digital Performer.

I’ve just learned about Found Images, which will be a fun trick to add to techniques like this so that the macro is even more bulletproof.

1 Like

Hey David

Found images is powerful if a little slow and processor-intensive.

Keyboard Maestro “Generic-Test 01” Macro

Use Cmd-Shift-4 and hold the Control-key down to copy to clipboard.

Click in the little box graphic field.

Paste.

Turn on 'Display'.

Test.

-Chris


(A KM7 macro — which may or may not import into KM6.)

Generic-Test 01.kmmacros (20 KB)

This is actually a bit intentional. The idea with Keyboard Maestro is to make the very basic creation of a macro simple - do the Tutorial to see the process and it is very quick and easy, familiar to everyone who is well versed in Keyboard Maestro.

But Keyboard Maestro is extremely powerful. If all that power was immediately apparent, most people would take one look and run away screaming. And that would be a shame, not just because it would be bad for my business, but because those folks would miss out on the value they could get from Keyboard Maestro.

So Keyboard Maestro is designed to allow you to relatively easily create simple macros that can do simple tasks. And often one single macro like this can be worth the purchase price alone. And now you get the rest for free. And then, when you're comfortable, you start digging a bit and you see just how many actions there are, and how many other triggers there are, and how you can use the text tokens and the functions to do all kinds of stuff, and that there are loops and branching conditions, and collections, and the possibilities are essentially endless. But if you saw it all right at the start it would be extremely daunting.

As for documentation, I agree, but I don't see a better solution. There are endless sources of informations:

  • Direct support.
  • In-built help (including the tutorial)
  • The documentation.
  • The wiki.
  • The forum.
  • and yes, YouTube.

I wonder if it is possible to build a google search page that searches all of them.

But, as I say, I'm not sure there is a good solution to this. I could get rid of the documentation, and just use the wiki, and I may eventually do that (certainly that is the direction I'm moving in). But the forum provides different stuff, and the direct support is always needed, so it only helps in a limited way.

Great video tutorial on Digital Performer - thanks for sharing!

Hey David,

Make it public. It's good enough, and there are other folks on the forum who are interested in making macros for Digital Performer.

-Chris

Thanks. I do like to polish my videos a little more and put my branding on them, etc., but I will definitely consider making more videos in this vein as I learn new tricks.

So my quick-and-dirty videos for friends or closed communities are private/unlisted, but the good ones are public.

Hey David,

In the vid you say Keyboard Maestro cannot show the screen position of things, and therefore you use record to get the location.

In KM6 there is not a built-in cursor-discovery-tool, but several of us have rolled-our-own.

In KM7 there is such a tool..

-Chris

Ah, great! This is quite handy. I migrated from iKey, which had a one-click button to “sample” the current location of the mouse. (You would click the “sample” button, then move the mouse to your desired location, then hold down the command key for 2 seconds, and iKey would record that exact location in absolute x/y coordinates.)

My video was made in KM6, which is why I didn’t know about this (and another reason I’d rather revise the video before making it public). I just checked in KM7 and am SO pleased to find this new “Get” command, which I’ll be using all the time, for sure.

Thanks Chris!

I've successfully migrated numerous TextExpander (TE) snippets to Keyboard Maestro (KM) macros triggered by typed strings! However, there are some macros that need to call other macros with a specific typed string because there are multiple typed strings to trigger the macro and I'm not quite seeing how to get this done with KM. If nothing is required to be passed, I have successfully triggered a macro from within a macro as shown below.

For the simplest example, I have a snippet 'filetrbl' which expands as "Railcar Trouble Report - %snippet:-cdt%" providing the filename of a file to be downloaded. The '-cdt' snippet expands to provide yesterday's date for inclusion into the filename. The '-cdt' snippet has already been migrated to KM, but it doesn't get invoked when I enter 'filetrbl' into the finder window for downloading the file.

I have other migrated macros that fill in text for the body of an email message using '-sdy' (last Sunday) and other date typed strings that don't get expanded. See the macro shown below for creating an email message requesting payroll summary information. Lastly, the documentation for running a macro from another macro recommends using the "Execute a Macro" action and that there should be a "With Parameter" option, but the actual available actions don't have a "With Parameter" option.

Keyboard Maestro “Test Payroll Summary Request Email Snippet” Macro

Test Payroll Summary Request Email Snippet.kmmacros (5.0 KB)

Keyboard Maestro typing will not trigger Keyboard Maestro’s Typed String triggers.

Instead, use the Execute Macro Action where you would otherwise type something to expand another snippet.

Or perhaps a more Keyboard Maestro way of doing it would be to have a macro group full of macros who just determine some information and store it in a variable that you can use in other macros. For example:

Macro "Set Yesterdays Date For Files"
Action: Set Variable “Yesterdays Date For Files” to text “%ICUDateTimeMinus%1%Day%yyyy-MM-dd%”

Then your -cdt macro looks like this:

Macro "cdt"
Trigger: Typed String -cdt
Actions: 
Execute Macro "Set Yesterdays Date For Files"
Insert Text by Typing "%Variable%Yesterdays Date For Files%
Macro Test Payroll
Trigger: F1
Actions: 
Execute Macro "Set Yesterdays Date For Files"
…
Insert Text by typing "… Week Ending: %Variable%Yesterdays Date For Files%

Sorry, I’ve clearly mixed and matches your macros and text, but hopefully you get the idea - separate the calculation of the values from the typing of the results so that you can use the calculated value in different macros.

Peter,

Thanks, I think I’ve understood your recommendation.

Your guidance indicates that although I have a macro with multiple triggers for determining last Sunday and numerous other days or dates often called upon as typed strings, I can’t use it from within another macro. Certainly in the case of yesterday’s date where it can be determined without logic, its easy to accomplish without the macro. Still I’ve reduced the number of individual snippets using KM and I’m pleased and appreciative.