KM Macro for Code Syntax Search using Dash app (API docs)

I’m thinking about writing a KM macro to search using Dash, an API Documentation Browser and Code Snippet Manager. It’s not a great Snippet manager, but the API/syntax search is awesome.

I’ve searched the forum, and in general, and have not found anyone who has done this, but I thought I’d check here just in case. If you have such a macro, or know of one, and don’t mind sharing, please post here.

I don’t expect it to be that hard.
Here’s the design:

  1. User selects text to use in search
  2. User enters search terms into KM dialog
  3. Remove all blanks, dashes, slashes, etc because Dash just wants all search words concatenated with no spaces, etc.
  4. Invoke Dash to do the search (not sure how yet, doesn’t look like AppleScript will work)
    – This is effectively the same as using the Dash Service which is installed with Dash
  5. Dash then opens and shows the search results.

#4 will take some research and testing.

If anyone has any ideas or suggestions, please post here.

I’ll post in the “macro” category section when done.

You probably know that:

  • LaunchBar 6 has a “Search Dash” action, and
  • in Applescript you can write open location "dash://{query}"

Nope, didn’t know about either.

I did look at the Dash AppleScript dictionary, and didn’t see anything useful.
In particular, I need to open a new tab in Dash to execute the search.

I’ll do some more testing. :smile:

Well, looks like it will be real easy.

Here's my first draft:

Here's my first complete draft.
Dash Search.kmmacros (10.6 KB)

Please feel free to test and post your bugs, comments, suggestions here.
If all goes well after a weekend of testing, I will post my first real release in the "Macro" category section.

My thanks to @ComplexPoint for his many contributions to this.

All comments welcome.

Thank you.
I am now using it with a simple Web Search in KM. :smile:

Search the Web
Title: Search Dash
URL: dash://%Search%

( FWIW, to include spaces in your search strings [same-page subSearches in Dash] you can flank any URL opening action with a percent encode filter )

1 Like