MACRO: Go To Macro by Name (Spotlight)

Awesome idea! I'm on KM10 and got this error:

image

After I remove the scroll macros, it searches and finds my macros nicely but hitting enter doesn't do anything. If I then manually Try Action on the Go to the selected macro - Abort if error group, it takes me to the requested macro.

I'm not sure if this will work for you or not, but give it a try:

[KM] Go To Macro by Name (Spotlight).kmmacros (40.3 KB)

1 Like

Yep that did it!! Thanks Dan!

1 Like

it works very nicely. Thank you very much Dan. I was wondering if there was a way to ignore disabled macros. I have many duplicates (work in progress in test groups) which hugely increases the number of results.
thanks again

Glad it works for you. Not at the moment, no. Maybe in the future, but I wouldn't hold your breath.

1 Like

thank you Dan !

1 Like

As a temp solution you could run this AppleScript in an Execute AppleScript action. It will disable all selected macros and prepend them "xx__" which will have the effect of moving them to the bottom of the list of macros in that group. When you search for a macro with @DanThomas tool they will still be displayed but they will be at the bottom of the list and have a prefix you know indicates they are disabled. (ultra minimal testing, i am not an AppleScript pro)

---------------------------------------------------------------
# Auth: cfriend
# dCre: 2022-07-03-09-00
# dMod: 2022-07-03-09-00
# Appl: Keyboard Maestro 
# Task: Enable or Disable the selected macros adding a prefix to send them to the bottom of alphabetical lists
# Reqs: Satimage.osax
#             http://www.satimage.fr/software/en/downloads/downloads_companion_osaxen.html
---------------------------------------------------------------

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

tell application "Keyboard Maestro"
	set macroList to every macro whose selected is true
	if (count of macroList) is 0 then
		display dialog "No Macros Selected" buttons {"Cancel"} default button "Cancel"
	end if
	repeat with aMacro in macroList
		set oldName to (name of aMacro)
		if oldName does not contain "xx__" then
			set newName to "xx__" & (name of aMacro)
			set name of aMacro to newName
			set enabled of aMacro to false
		else if oldName contains "xx__" then
			set newName to change "xx__(.*)" into "\\1" in oldName with regexp without case sensitive
			set name of aMacro to newName
			set enabled of aMacro to true
		end if
	end repeat
end tell
1 Like

I will test it thanks very much !

You’re welcome. Pls note it requires Satimage.osax, the download URL is in the script header.

1 Like