PURPOSE:
• Open Macro and Group in KM Editor from Selected Macro or UUID
• Provides same function as Dan's "Reveal Macro Group",
and ADDs search by UUID from any app.
• This Macro auto-switches based on the front-most app.
AUTHOR: JMichaelTX (very minor mod)
DanThomas, original macro
USAGE:
Do either of these:
• Select a Macro in Keyboard Maestro.
OR
• Select KM Macro UUID (from any app)
THEN run this Macro
CHANGE LOG
1.1.1 2016-07-14
• CHG: Uncheck "Include Errors" in Execute JXA Actions to prevent
false positive error when running macOS Yosemite
• CHG: Error msg in Execute JXA Action #2 to indicate invalid UUID
This is a minor update based on the macro built by @DanThomas.
It simply adds an alternate source for the UUID (any app, like AppleScript)
Syntactically, I'd prefer a better solution than the nested repeats I use, but I can't figure out the native AS syntax for finding an item that contains an item with a property of a specific value. But it doesn't really matter - I's sure it doesn't do much more, internally, than what I coded.
@JMichaelTX, @DanThomas I try Dan fix so (of course) no more JXA error message, but the macro [KM] Reveal Macro and Group From UUIDdoes apparently nothing (with/without Dan fix) in my case… at present
@DanThomas Thanks for the AppleScript version: I will let you know about…
@alain, the macro has two modes, and you must do one or the other of these selections before running the Macro (BTW, you need to set a trigger for the macro):
Select a valid UUID (as text somewhere outside of KM) for a KM Macro
Click on "All Macros" group, and then select a Macro
The result should be, in both cases, the Macro Group for the macro is selected, and the Macro is selected.
Perhaps we should have put in some regex checking to make sure we had something that looked like a UUID.
I don’t know why I don’t do that - I did it in one macro, and then just quit doing it. And it’s stupid, really, because I learned a long time ago that the more attention I spend on error checking, the less I have to debug someone else’s issues - or, for that matter, my own issues when I forget how something works (which is often, these days).
And even more with some detection (with a message) of group UUID in place of macro UUID; same for non-existing macro UUID…
But don’t worry Dan, this is not the current trouble.
@JMichaelTX Thank for your detailed and careful help, but it was that I have done (I think so at least ) and nevertheless the right group was not selected…
As I have an AppleScript, I will manage by myself when I will have more time to play with.
On my Yosemite machine too (Thanks for your kind pugnacity) for the "~~~ ANY OTHER APP ~~~" branch... not for the KM Editor one (i.e. don't reveal the selected macro group).
[EDITED 15/07/2016 11:58:58 Paris time]
It's quite subtile: In fact, within KM Editor, selection of a given macro imply first a selection of its group if it is not already selected so there is 2 different situations:
the right group is already selected and visible: nothing more happen and it is OK,
the right group is already selected but need a scroll of group window: nothing more happen and it is weird.
BTW I add few more KM filtering actions, just to be more comfortable in UUID "raw" selection ;-):
Other point: I feel the need of selection of an UUID string as an alternative of macro selection, a kind of validation of macro/group UUID.
@JMichaelTX - Can you test this for me on your Yosemite machine? It's not a suggested change to your macro (although it does include a version bump just to be clear) - it's to test a sub-macro I wrote to filter out the warning message. If the sub-macro works, I'll post it.
Test this to make sure that the warning message is shown in one window, and filtered out in the other. The filtered result should be EXACTLY like the warning message was never there. So if you test it with a good UUID in the clipboard, the result should be empty, and if not, the result should contain your error message and nothing else - no extra "newlines" or anything.
Basically, I usually return "OK" when there's no errors, and I want to be able to test the result variable for "is 'OK'" and have it work regardless of whether it's run on Yosemite or not.
@DanThomas, OK, I will test when I get a few minutes.
Just so everyone knows, the need for this macro will be short-lived.
It is due to a bug in the KM Editor Search that causes search for a UUID to fail. @peternlewis has identified and fixed this bug for the next KM version.
My point being that I don’t see much value in continuing to optimize this macro.