What changed in the second action? It looks the same (I think).
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?
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 ).
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.
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.
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!
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.
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.
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.
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
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.
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.
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!!
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.