Preview Legal Case in Pop-Up Browser Window (without activating browser)

This macro (available here) is almost identical to the macro featured in a previous post ("Preview Top Hit"). Like that earlier macro, this one also leverages KM to chain together the functionality of some disparate productivity tools, including Automator, LaunchBar and Brett Terpstra's SearchLink tool, both the latter of which must be installed to make this work.

Where the other macro executes a general purpose Lucky Google-style search, this macro is designed for lawyers, like m'self. We lawyers might be writing a brief and need to quickly pull up a case to get a page cite, or whatever. The macro takes selected query text, usually you'd want to use a case name (xxx v. yyy), and does a top hit search for a legal opinion on Google Scholar (which has a pretty much complete database of legal opinions from the Supreme Court, the federal appellate courts, and the state supreme courts) and pops up a browser window with, hopefully, exactly the case you're looking for, without opening the browser app (Safari), allowing for a quick scan and easy dismissal of the window. The beauty of this for me is, I don't have to remember the exact case cite, I just need to remember the parties, e.g., Strickland v. Washington, which is a case I refer to frequently.

First, the macro copies the text selection, let's say it's Strickland v. Washington. It then wraps the clipboard text in SearchLink syntax. The syntax will cause SearchLink to run a top hit search and return the top hit URL to the clipboard (as opposed to outputting a Markdown link, for example). The syntax looks like this:

!ls Strickland v. Washington !!^

This syntax, when run through SearchLink, will trigger a custom search in Google Scholar's legal database and return the top hit -- a case opinion -- to the clipboard.

Let's take a little diversion:

Now, in my previous post, I urged y'all to install SearchLink because it makes this macro possible ... and ... it's awesome in many ways (thanks Brett!). One of the things SearchLink does is install a .searchlink configuration file in the home directory. This file contains default values and custom search argument syntax which can be altered by the user. The Google Scholar legal database search argument must be inserted into the .searchlink file to make this macro work. The relevant portion of the file looks like this:

You can see the Google Scholar legal database search argument at the bottom:


Again, this argument must be added to the .searchlink file in order for this macro to work. It is, in essence, a "Lucky Google Scholar" search.

OK, so once the clipboard has been wrapped in the SearchLink syntax, the macro then executes a workflow...

... which sends the selected text, now copied and wrapped, to LaunchBar, as a text item.

The macro now hits the TAB key to point the text item in Launchbar to an action. Another workflow is called which points LaunchBar to the SearchLink action (SearchLink must be accessible via Launchbar). (The SearchLink action is a service workflow that SearchLink installs in your Services directory).

LaunchBar will look like this for a second:

The macro then executes the SearchLink action by hitting Return. SearchLink returns a top hit URL for, typically, the exact legal case you're looking for, to the clipboard. The higher the court and the more landmark the case, the more on target SearchLink will be.

The macro then activates an Automator application I made called "Preview URL App" (available here and see my KM Macro Library post here). This app pops up a browser window, without opening Safari, using any URL in the clipboard. It will now be used to pop up a browser window for the top hit legal opinion URL returned by SearchLink.

Finally, the macro clicks the center of the screen, and thus presumably the center of the pop up window, in order to bring it to the front (for some reason, the pop up is never at the front when it materializes). This allows you to dismiss the window with the Escape key or either the Cancel or OK button on the bottom of the window.

Here it is in action:

Of course, if you don't like the top result, you can always go ahead and do a Google Scholar search using the full powers of your browser. This macro is built for speed (I like to think), not necessarily accuracy!

You can also fool around with it and set it up to accept a search query via input text prompt.