[KM] Reveal Macro and Group From UUID

####Results on Keyboard Maestro 7.2 (7.2) on macOS 10.11.4

Window 1

Result before filter (surrounded with ><):
>/var/folders/_2/7b0tgl916vg3ft82hgl011vm0000gn/T/Keyboard-Maestro-Script-AF3D68DE-7DC2-49C6-B3B5-EBD40CD59449:396:528: execution error: Error on line 18: Error: This is NOT a valid UUID: everyone

 You must FIRST select a valid Macro UUID in any app other than KM (-2700)<

Window 2

Result after filter (surrounded with ><):
>/var/folders/_2/7b0tgl916vg3ft82hgl011vm0000gn/T/Keyboard-Maestro-Script-AF3D68DE-7DC2-49C6-B3B5-EBD40CD59449:396:528: execution error: Error on line 18: Error: This is NOT a valid UUID: everyone

 You must FIRST select a valid Macro UUID in any app other than KM (-2700)<

I’ll be back with Yosemite results.

Thanks. That’s interesting.

Looking forward to the Yosemite results.

ALL Tests below using Keyboard Maestro 7.2 (7.2) on macOS 10.10.5

###Test with VALID UUID

475E2471-99B7-4B3E-BB97-25D0552DC412

BEFORE

Result before filter (surrounded with ><):
>2016-07-15 14:11:56.284 osascript[10591:147397] warning: failed to get scripting definition from /usr/bin/osascript; it may not be scriptable.
2016-07-15 14:11:56.285 osascript[10591:147397] warning: failed to get scripting definition from /usr/bin/osascript; it may not be scriptable.<

AFTER

Result after filter (surrounded with ><):
>2016-07-15 14:11:56.285 osascript[10591:147397] warning: failed to get scripting definition from /usr/bin/osascript; it may not be scriptable.<


###Test with INVALID UUID

TEST-FOR-INVALID-UUID

BEFORE

Result before filter (surrounded with ><):
>2016-07-15 14:08:06.033 osascript[10456:145178] warning: failed to get scripting definition from /usr/bin/osascript; it may not be scriptable.
2016-07-15 14:08:06.034 osascript[10456:145178] warning: failed to get scripting definition from /usr/bin/osascript; it may not be scriptable.
/var/folders/6z/1fv5pk7x5xv_sdxzgmnhy_6h0000gn/T/Keyboard-Maestro-Script-BE9FD807-8E4A-449C-A261-A3ED4256CC43:396:528: execution error: Error on line 18: Error: This is NOT a valid UUID: TEST-FOR-INVALID-UUID

You must FIRST select a valid Macro UUID in any app other than KM (0)<

AFTER

Result after filter (surrounded with ><):
>/var/folders/6z/1fv5pk7x5xv_sdxzgmnhy_6h0000gn/T/Keyboard-Maestro-Script-BE9FD807-8E4A-449C-A261-A3ED4256CC43:396:528: execution error: Error on line 18: Error: This is NOT a valid UUID: TEST-FOR-INVALID-UUID

You must FIRST select a valid Macro UUID in any app other than KM (0)<

If you’re having fun with this, carry on. :smile:

Otherwise, I don’t think it’s worth the effort just to suppress the KM error msg when using JXA with Yosemite. As you know, just uncheck “Include Errors”, and display any real error msg from JXA. Just my lazy opinion. :wink:

Yep, I totally agree. I thought this was “just going to work”. So, “never mind”.

Thank you SO much for helping. Something good is coming very soon.

Isn’t that a quote from some book/movie/video/soundtrack?
It sounds very familiar.

Well, there’s “Something Wicked This Way Comes”…

Hey Dan,

Were you talking about this?

-Chris

Chris - Thanks.

Thanks! @JMichaelTX @DanThomas
Another great macro that I can't live without. Really should hang out here in the forum often :wink:

1 Like

I use this macro a bit.. It currently errors...

## Error: Invalid index.

Hey @troy,

That critter is old and obsolete. Try this.

-Chris

--------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2021/11/12 13:10
# dMod: 2021/11/12 13:10 
# Appl: Keyboard Maestro
# Task: Go-To the Selected Macro's Parent Macro Group.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Keyboard_Maestro, @Go-To, @Parent, @Macro-Group
--------------------------------------------------------

tell application "Keyboard Maestro"
   set selectedMacroList to (get selected macros)
   if length of selectedMacroList = 1 then
      set selectedMacro to item 1 of selectedMacroList
      tell selectedMacro to set parentMacroGroup to its macro group
      select parentMacroGroup
   else
      display notification ¬
         "Please select only 1 macro!" with title ¬
         "Keyboard Maestro" subtitle "·······················" sound name ¬
         "Tink"
   end if
end tell

--------------------------------------------------------

I replaced what I thought I should replace in the old macro,
Obviously I did it wrong,
A little help?
It does work if in the KM app.
But I use it in Filemaker to highlight the UUID and have it take me to KM and show me the Macro and group, that part is not working.
ie. if I'm using Open URL in FMPro, and the string is
"kmtrigger://macro=8A22B7D4-6196-4024-9A5C-A19EEA5E2CB0&value=Whatever"
I used to be able to copy 8A22B7D4-6196-4024-9A5C-A19EEA5E2CB0 then run the macro and it would take me to the macro/group in KM
=)
thanx man

[KM] Reveal Macro and Group From UUID.kmmacros (24 KB)

I missed the fact that the macro would work with a bare UUID string.

My first script works with the selected macro in the Keyboard Maestro Editor.

This one will work with a UUID in the clipboard.

set theUUID to the clipboard as text

tell application "Keyboard Maestro"
   activate
   editMacro theUUID
end tell

I'm not particularly interested in fooling with @JMichaelTX's macro.

-Chris

1 Like

Beautiful! Thank you so much, I use it a couple times a day!

You're welcome.

Here's a variant that will search the clipboard text for a UUID and use that to open the macro in the Keyboard Maestro Editor.

It uses the Keyboard Maestro Engine's search/replace function for same.

Using this you can be sloppy with what you copy to the clipboard.

-Chris

--------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2021/11/14 10:13
# dMod: 2021/11/14 10:13 
# Appl: Keyboard Maestro Editor, Keyboard Maestro Engine
# Task: Find a Macro UUID in the Text on the Clipboard, and open it in the Keyboard Maestro Editor.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Keyboard_Maestro_Editor, @Keyboard_Maestro_Engine, @Edit, @Macro
--------------------------------------------------------

set sourceData to the clipboard as text

set sePattern to "(?s-im).*([A-Z0-9]{8}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{12}).*"
set rePattern to "$1"
set theUUID to my kmCng:sePattern inStr:sourceData withStr:rePattern usingRegEx:true usingCase:true usingTokens:false

tell application "Keyboard Maestro"
   activate
   editMacro theUUID
end tell

--------------------------------------------------------
--» HANDLERS
--------------------------------------------------------
# Uses the Keyboard Maestro Engine for RegEx Support.
on kmCng:regExPat inStr:dataStr withStr:replacePat usingRegEx:regExBool usingCase:caseBool usingTokens:tokensBool
   tell application "Keyboard Maestro Engine"
      set foundDataList to search dataStr for regExPat replace replacePat ¬
         regex regExBool case sensitive caseBool process tokens tokensBool
   end tell
end kmCng:inStr:withStr:usingRegEx:usingCase:usingTokens:
--------------------------------------------------------
1 Like

Extra awesome CHRIS! Your brain/ears must’ve been burning because when I got the previous version and was using it I thought, “wouldn’t it be great if you could filter out a UUID within a longer text string”. And here you are!
Most excellent.

I thought about doing that yesterday, but I was too tired.

1 Like