MACRO: Go To Group by Name (Spotlight)

You should be able to find the "/Library/ScriptingAdditions/Adobe Unit Types.osax file and remove it.

Very nice work! Extremely useful!

1 Like

@DanThomas
Hi Dan! After installing the newest KM V9.0 with macOS Mojave 10.14.6.
Running this Macro reports the following error:

System Events got an error: Can’t set window "Keyboard Maestro Editor" of application process "Keyboard Maestro" to true.

Num: -10006

I don't have version 9 yet. Can you see if you can isolate which action is causing the error? Put "Prompt" actions throughout the macro, until you can isolate what action causes the error. Then let me know.

Thanks.

@JMichaelTX, @ccstone: Just adding you guys into this in case you have ideas, or can figure this out. I honestly can't imagine why I'd ever be trying to set a window to "true" - it doesn't even make sense. Thanks.

Sorry, Dan. I'm running KM9, but I have never installed your macro. I do use your "Go To Macro" macro, and it works fine under KM9.

FWIW, I have my own macro which uses AppleScript to go to a group. If anyone is interested, let me know and I will post.

1 Like

@DanThomas, I suspect this is due to the fact that in KM9 the KM Editor window name/title has changed. For example, it now looks like this:
Keyboard Maestro Editor — Go To Macro by Name (Spotlight) (Author.@DanThomas)

Chris @ccstone has devised a solution for this:

tell application "System Events"
  tell application process "Keyboard Maestro"
    set frontmost to true
    tell (first window whose subrole is "AXStandardWindow")
      
      ### YOUR CODE HERE ###
      
    end tell
  end tell
end tell

1 Like

Oh, well, that's just peachy. Are you having problems with things like KMFAM, or any of my other macros you use?

Nope. KMFAM is working great! This issue is only come up when you are using UI scripting.

1 Like

You say that like you think I remember how any of my stuff works. :stuck_out_tongue:

Thanks for the info.

Wood-working isn’t healthy for the brain :crazy_face:

I have a lifelong affliction called "CRS". It stands for "Can't Remember S....quat".

2 Likes

Yes, of course. after running it step by step, it reported the problem after this action. ▼

This action is in a sub-macro named Macro Scroll Position - Store for Current Macro (Sub-Macro), and the popup error message is the same as what I've posted before ▼

Macro Scroll Position - Store for Current Macro (Sub-Macro)

An error has occurred: System Events got an error: Can't get window "Keyboard Maestro Editor" of process "Keyboard Maestro".

BTW, the same error reoccurred even if reinstalling this macro.

It'd be great to have a new way to solve a problem I suppose. :smile:

Just disable the calls to the "Macro Scroll Position" macros. Everything else should work fine. Fingers crossed.

That works for the macro Go To Macro by Name (Spotlight). But doesn't work for the macro Go To Group by Name (Spotlight), Actually, the latter doesn't involve "Macro Scroll Position" macro as a sub-macro. When you run it, It can perfectly take you to the macro group you wanted to go, but it has been keeping popping up the error as I described before.

Disable the action shown in the red box:

image

@ccstone: I believe you have a workaround for this code?

--------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2015/07/25 03:06
# dMod: 2015/07/25 03:14
# Appl: Keyboard Maestro & System Events
# Task: Set Focus to Macro List
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @System_Events, @Keyboard_Maestro, @Focus, @Macro_List
--------------------------------------------------------------------------------

try
	
	tell application "System Events"
		tell application process "Keyboard Maestro"
			tell window "Keyboard Maestro Editor"
				tell scroll area 2 of splitter group 1 of group 1
					set focused to true
				end tell
			end tell
		end tell
	end tell
	
on error e number n
	set e to e & return & return & "Num: " & n
	if n ≠ -128 then
		try
			tell application (path to frontmost application as text) to set ddButton to button returned of ¬
				(display dialog e with title "ERROR!" buttons {"Copy Error Message", "Cancel", "OK"} ¬
					default button "OK" giving up after 30)
			if ddButton = "Copy Error Message" then set the clipboard to e
		end try
	end if
end try

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

If you do, can you post it? Thanks.

Dan

1 Like

Dan, clearly I'm not Chris, but I gave you his solution earlier.

Replace:
tell window "Keyboard Maestro Editor"

With:
tell (first window whose subrole is "AXStandardWindow")

2 Likes

Thanks, Jim

@Alice_Shi - there's your answer, if you don't want to just disable it.

Thank you! Dan. I'm so happy It works again. I just can't image a day without this macro.

I have to say that I'm sorry for the confusion I've caused -- this reply → MACRO: Go To Group by Name (Spotlight) - Macro Library - Keyboard Maestro Discourse_2019-08-19 is base on 'Go to Macro by Name' instead of ''Go to Group by Name'. I was a little bit mix up. Maybe it's puzzled you.

No worries, I eventually figured it out. And being confused is a common state for me, anyway. :stuck_out_tongue: