@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.
####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)<
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.
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.
--------------------------------------------------------
# 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
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:
--------------------------------------------------------
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.