MACRO: Go To Group by Name (Spotlight)

I was able to incorporate some of @ccstone’s great work (thanks, Chris!), and I just posted an update which I think will do what you want. I replaced the link at the top of the first message.

All you need to do is delete the current Go To Group by Name macro, then import the new one. Don’t bother with the Spotlight Search Prompt macro.

1 Like

Thank you, this is perfect.

I am curious, what is included in the pkg? Is it something that you can’t include in the macro itself?

I have a problem. Now every time I try to delete the .pkg, it asks me to locate the .pkg file even though I did it earlier. Do you know why that might happen? Didn’t have that issue before I believe.

You’re not supposed to delete the .pkg file. It contains required resources.

Oh I see, I will just move it then. Thank you.

You’re not the only one who was confused. Clearly, I need to re-think the idea of using package files for resources.

And here, I was so proud of myself for coming up with the idea! Sigh. :wink:

I’ll figure something else. Right now, I’ll post a note on all the macros.

Thanks for this info. Keep it coming. Remember, if you’re having issues, chances are someone else will also. Just because things make sense to me doesn’t mean they make sense to other people… In fact, they rarely do!

Hey Dan,

Perhaps.

Most people don't know that they can right-click on a .pkg file and open it for inspection.

People may feel more comfortable with a km-resources folder.

-Chris

1 Like

@DanThomas I moved the Resources package, then clicked several of the installed macros, which asked me to locate the resources package. I located it and clicked OK...but the file dialogue simply pops back up asking to locate the package again, so I'm stuck in a loop until I hit cancel, but the macros don't work. They just ask me to locate the package file again. Love the idea of being able to go to a group quickly and look forward to getting it to work! :slight_smile:

If it keeps asking, that means that either it can't read the package, or there's something wrong with the package. Where did you put the package? What folder?

Thanks for your quick response. I tried the pkg file in multiple locations. The first was in a folder in Dropbox. I threw that copy away and unzipped the original zip file to get a fresh copy of the pkg file. I put that fresh copy in a folder named "Spotlight Search Prompt Resources" in the Documents folder. Then I tried putting the pkg file in the documents folder itself. Same result: keeps asking to locate the pkg file. That pkg file is called "Spotlight Search Prompt Resources.pkg". I got it from the zip file at the top of this thread: Go To Group by Name (Spotlight).v1.1.zip.

I'm using Sierra 10.12.3.

If you look in the Spotlight Search Prompt macro, two actions down from the top, you should see a group with the description "Verify and/or set DND__sspResourcesPackagePath". If I understand your issue correctly, this is where you get stuck.

Here's the reasons that set of actions would continue to loop:

  1. You're not selecting the package file.

  2. For some reason, it doesn't have rights to read the package file.

  3. Inside the package file, which you can view by right-clicking on it and selecting "View package contents", there should be a file named "Spotlight Search Prompt.html". If there isn't, then there's something wrong with the package file.

That's all I got. So look at the actions I mentioned, and see if you can figure out what's wrong.

Dan

Well...I think I figured it out. Occasionally, I get an odd addition in a variable that looks like this...

osascript: OpenScripting.framework - scripting addition "/Library/ScriptingAdditions/Adobe Unit Types.osax" cannot be used with the current OS because it has no OSAXHandlers entry in its Info.plist.
/Volumes/.../Spotlight Search Prompt Resources/Spotlight Search Prompt Resources.pkg

The ellipsis is my edit for privacy. I have never been able to completely get rid of that osax file reference. I sometimes have to write a string filter into my script to remove that reference from a variable result before moving on in the script.

I removed the offending text from the variable and...walla.

P.S. So...I went to the scripting additions folder and removed the osax file. :thinking: Seems like I would've already done that before. Maybe it keeps reappearing. We will see.

Thanks for your help Dan @DanThomas

Wow, that's strange. Good sleuthing on your part, though! Glad you got it figured out!

Dan

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?