MACRO: Run Current Macro

MACRO: Run Current Macro

UPDATED v1.2.1 2016-08-10: Increased timeout

UPDATED v1.2: If you run this macro when the Keyboard Maestro Editor is not the active application, you will be asked if you want to continue or not. Also, the TriggerValue prompt now includes the name of the macro, Thanks to @JMichaelTX for his suggestions and code examples,.

Run Current Macro v1.2.1.kmmacros (44.8 KB)

This is quickly becoming one of my favorite macros, and I just wrote it this morning!

  • Assign a hotkey to this macro.
  • Then when you're editing any macro, just tap the hotkey and the macro you're editing will run.
  • If your macro requires a %TriggerValue% parameter, then instead of tapping the hotkey, hold it down for half a second.
  • A prompt will pop up, asking you for the TriggerValue.
  • Click OK, and the macro is run with the TriggerValue.
    ###But wait, there's more!
  • The next time you tap the hotkey to run that macro, it remembers the TriggerValue you used before, and uses it again.
  • In fact, it can remember a different trigger value for each macro!
  • Want to change the TriggerValue or get rid of it altogether? Hold down the hotkey, and change the value in the prompt, or clear it out entirely.
  • All trigger values are stored as normal KM variables, so you can also clear them out via Preferences->Variables, if you want.

Why has this become my favorite macro?

I know it's really easy to assign a hotkey to whatever macro you're working on. But for some reason, the fact that this key is right there for any macro makes running the macro you're editing a snap.

And the added bonus of being able to supply a TriggerValue completes the joy of using it. Really!

8 Likes

Another great macro by @DanThomas! :thumbsup:

Here’s another benefit, and for me, probably the most compelling:
I don’t have to remember to remove the test trigger when I’m finished.
I’ve been using F1, but I end up with a bunch of macros with that trigger that I don’t want.

Also, it will be great for example macros uploaded to the forum. Again, I don’t have to remember to remove the hotkey.

So, F1 will be assigned ONLY to your macro. :smile:

But Dan, my macro inbox is full. Can you please write a macro that will:

  1. Download all your macros on an hourly basis
  2. Install them for me.
  3. Train me how to use them.
  4. Post a thanks reply.

That would really save me a lot of work. LOL

Working on #2. Soon. Plan on doing #3 - part of the reason I’m trying to get my macros on the forum is so I can point to them when I do videos. I’ll leave #'s 1 and 4 to you. :slight_smile:

Thanks, by the way.

Do you remember who it was that first mentioned the idea of holding down a hotkey versus tapping it? It’s such a marvelous idea, and I want to credit him, but I don’t remember who it was.

Dan, I just ran it, twice, and the thought that immediately came to mind was:
slicker than owl sh…

I think you will probably recognize that old, very old, expression. :wink:

I don’t. But my guess would be either @ccstone or @Tom.

That’s not one of my expressions - I think it must be a Texas thing. But it doesn’t really need an explanation, does it? :stuck_out_tongue:

Like I said in the comments - it’s quickly becoming one of my favorite macros.

Just found a bug. Well, actually, not a bug. But a misleading error message:

What actually happened is that I tried to run a macro in a group that is only active when Quiver is the active app. Since the KM Editor was the active app, it wouldn't run the macro. But the error says "found no macros with a matching name".

I'm going to put in some checks to verify the macro and group are active.

OK, updated to v1.1. Better error message:

Either the Macro is not enabled, or the Group that contains it isn’t active or enabled.

Yeah, I already noticed that you have shamelessly stolen my patented long key press. Shame on you :open_mouth: (At least you announced it beforehand ;‌-)

But now I’m stealing back from you. I’ve already started with your AppleScript for running a macro with ‘selectedMacros’. And that’s only the beginning… :stuck_out_tongue:

So, I’m standing on your shoulders, and you’re standing on mine? How Mobius of us!

Thanks again for the great idea of the “long press”. I know you stole it from somewhere else, but still… it’s so cool!!!

Indeed! I had the idea when I was reflecting on the usefulness (and sometimes not usefulness) of long presses and force touches on iOS.

1 Like

BTW, also macOS uses long key presses, unless you have disabled it:

1 Like

All this standing around is wasting time!
You guys get back to work producing more macros that take up my time downloading and installing!

LOL

3 Likes

Great macro, Dan!

I’d like to request two enhancements:

  1. Support running the last macro selected for editing when the active app is an app other than KM. I often need to test macros that require the active, frontmost app to be something else, like Evernote.
  2. Provide an optional prompt showing the macro name and confirming the user wants to run it.

Thanks.

Thanks!

Have you tried it? It just asks the KM Editor for the currently-selected macro, and the KM Editor returns the selected macro regardless of whether the KM Editor is active (has to be running of course, but shouldn’t have to be active).

Sounds reasonable. How would you imagine that would work? Holding down the key is for prompting for a parameter, so I wouldn’t think that would be a good idea.

Yes, but evidently I was doing something wrong, like having the Macro Group disabled. :smile:

So, running with another app being active works.

I inserted these two Actions (in purple), but the Macro Name comes back as "Not Found"
What am I doing wrong? How do I get the name of the Macro to be run?

I don't see the need for any special UI. Just add the Actions and enable or disable however you like for the default. The user (as part of setup) can then change to suit his/her perf.

I'll post how I do it, and hopefully someone else can show me the one-step way of doing it, because I could never get it to work. And don't laugh at my convoluted solution - it works!

NOTE: In the second action, the word "uid" is NOT a variable. It's just text, and I replace it in the third action.

Hey, I know a guy that has already figured this out. LOL

Check out this:

So, here's my two Action to get the Macro Name, following your example:

Why the hell didn’t that guy speak up earlier?

(I hate it when that happens. :confused:)

Anyway, cool! So show me how you’d change the macro, or just post it. (You want it, you do it! :slight_smile:)