MACRO: Run Current Macro

Here's my small revision: Added 4 Actions (+ Change Log), all in purple.
Feel free to revise to suit your needs and style.

###MACRO: Run Current Macro

Run Current Macro 1.1.1.kmmacros (44 KB)

This is really working out to be a great macro for me -- using many times a day.

A couple of questions/comments:

  1. What changed in the second action? It looks the same (I think).
  2. If I’m reading this correctly, it only alerts you of what macro is running - it doesn’t prompt you if it’s OK. Am I right? All you wanted was to be notified what it was running, with no chance to stop it?
  3. It would make sense to add the macro name to the Prompt for User Input title somewhere, don’t you think.

And lastly, I mean, seriously, you couldn’t tell what variable naming conventions I was using, and conform to them? That’s the first rule of modifying other people’s code - follow their style and conventions (assuming they have any), regardless of whether you like them or not (the styles and conventions, not the person :slight_smile:).

In my opinion, there’s only two times I wouldn’t do that - again, assuming they have a style or conventions. They are 1) Something is just flat-out wrong. 2) I couldn’t if I wanted to, because it’s over my head (we won’t name any names here).

I’m smiling as I type this, because I’m not ticked or anything. But let me tell you my thinking on this: I show respect to the other developer when I try to match their style, even if it makes my skin crawl a little. Maybe especially then.

So that’s my thoughts.

Maybe you are confused about which actions I changed.
I didn't change ANY actions. I ADDED 3:

The first two of those are modeled exactly after your actions in
MACRO: Get Selected Macro UUID (and name) (without the clipboard)

The 3rd is an ALERT, which does pause, and gives you the option to stop/cancel the macro.

I agree, except: You asked for my changes, which I had already done just for my own purpose, never intending to post. My post was just to show you my changes. I didn't expect you to use my revision as a replacement.

Feel free to totally discard my update if it is of no value to you. :smile:

OK. First, there are 5 actions in purple. That’s where my confusion was - I guess I made that first one purple myself - I forgot! :confounded:

Second, and this is another time to blush, I guess I’ve never used “Alert” before. I was thinking it was like Notify. I always use a Prompt to do what Alert does.

I’m having a great day, huh? Forgot I already knew how to get the name of a macro from it’s ID, and now this. LOL.

As far as the style/convention thing: I think my assumption was reasonable, since you went to the trouble of adding the change log and such. I personally wouldn’t have added that for my own uses, or at least nothing more than “I changed this”. But good on ya for doing that!

Anyway, that’s where my misunderstandings came from.

No problem. I wasn’t trying to influence or change your style – I was just being style-agnostic, and wanted to be clear, but didn’t feel the need, nor have the time, to figure out your style, and conform to it. That’s why in my upload post I stated:

My changes are very minor – just 3 lines of “code”. LOL

OK, I posted a new version. It only prompts if you aren’t running from the editor.

Also, the TriggerValue Prompt now includes the macro name, so it functions as the “do you want to continue” prompt, if you use the long key press option.

Very cool! :thumbsup:

1 Like

Dan, I used your technique in MACRO: Get Selected Macro UUID (and name) (without the clipboard) to make this KM Wiki update:

MacroNameForUUID Token – KM Wiki

Please advise if you do not find it correct and clear, or if you have suggestions for improving it. Better yet, since you are also a Wiki editor, please feel free to update if you feel it needs it.

thanks.

Hey, I even forgot it existed, and you expect me to critique what you wrote? LOL.

It looks great to me. Glad it’s documented somewhere. Hopefully I won’t forget next time. :slight_smile:

Dan, this is definitely one of my favorite macros, that I use many times a day and saves me a lot of trouble and headaches because I don't ever have to assign a trigger to macros I am testing or developing as examples.

It has worked flawlessly, but today I run into one minor hitch:

It apparently timed-out while I was viewing the Display Text action of the macro it invoked. Not a big deal at all, but better not to have this behavior.

I'm not sure what the best fix is, but I changed the Script Action to unchecked "Abort on Timeout" and "Notify on Timeout"

Just after I posted this, it occurred to me that this may be an AppleScript error, not a KM error. So, I added a with timeout to your AppleScript:

tell application "Keyboard Maestro Engine"
  set rcmMacroUUID to getvariable "rcmMacroUUID"
  set rcmTriggerValue to getvariable "rcmTriggerValue"
  
  --- PREVENT AppleEvent TIMEOUT WAITING FOR TARGET MACRO TO COMPLETE ---
  with timeout of 60 * 60 seconds
    do script rcmMacroUUID with parameter rcmTriggerValue
  end timeout
  
  return "OK"
end tell

I ran into the same issue a few days ago, and I fixed it but never uploaded it.

So I just uploaded a new version.

By the way, I don’t believe the thing you changed will fix the problem. I think I had to specify a timeout value of 10 minutes in the AppleScript code itself. Obviously you could change it to a higher value if needed.

And yes, I use it constantly also. I can’t believe it doesn’t have more downloads. Not that my ego is bruised - people can do whatever they want. But now that I have this, I can’t ever imagine being without it!

Anyway, thanks for the support. Let me know if you run into any issues.

Yep, just updated my post as you were posting your reply.

Saw that. LOL. There’s got to be a term for that. Like “letters crossing in the mail”, but more modern.

Hey Dan,

Try this instead of a timeout:

tell application "Keyboard Maestro Engine"
   set rcmMacroUUID to getvariable "rcmMacroUUID"
   set rcmTriggerValue to getvariable "rcmTriggerValue"
   
   ignoring application responses
      do script rcmMacroUUID with parameter rcmTriggerValue
   end ignoring
   
   return "OK"
end tell

-Chris

1 Like

Hey Chris, doesn’t that also mean that the script will ignore error msg from the app:

From the AppleScript Language Guide:

Discussion
A response to an application command indicates whether the command completed successfully, and also returns results and error messages, if there are any. When you use an ignoring application responses block, you forego this information.

Results and error messages from AppleScript commands, scripting additions, and expressions are not affected by the application responses attribute.

I think I prefer the with timeout command.

1 Like

Hey JM,

As usual the syntax you use depends upon what you’re doing.

-Chris

Thanks for this macro Dan it beats Comtion (Command+Option (⌥)) + t in many ways for trying out macros. No more selecting all the actions command+a and then running them. Plus of course you have to be in Keyboard Maestro for this to work which more times then not it is not what you are looking for, Dan you have some great stuff.

Kind of similar to the long press and one of the big things that wowed me about Keyboard Maestro (next to image find) was the repeat action with the long press. I use this in several macros now for various thing including adjusting sliders on the screen with long press. This gives me a lot more control then what I would get out of the trackpad or using the mouse wheel for various things. I got this from SteveInChicago on the Steinberg forums.
http://www.steinberg.net/forums/viewtopic.php?t=47721#p293626

Scroll Up and Down Examples - Skillet Macros.kmmacros (47.3 KB)

1 Like

What was the fix for the error message "Either the Macro is not enabled, or the Group that contains it is active or enabled" .. when the group is surely active and enabled and the hotkey was modified in the script as instructed? Thanks!!

Not sure, but make sure you're in Edit mode also.

FWIW, I've been using @DanThomas' macro since the day he published it, and it has always worked fine, and still does running Keyboard Maestro 9.0.4 on macOS 10.14.6 (Mojave).

The ONLY time I see that error msg is when what is says is actually true.