ramblings, rants and red pills
One of the features I love about [LaunchBar][] is it’s *Search Templates*: They allow you to define query templates for Search Engines, Amazon, Dictionaries … whatever service that takes the search arguments as a `GET` request.
[QuickSilver][], on the other hand, does not do that *natively* — but fortunately, there’s a great solution to that problem: [AcidSearch][].
In the words of its developer:
> [AcidSearch][] is a search enhancement for Safari. It adds unlimited “Search Channels” to the Google search field.
In other words: You’re not limited to a “Google Search” in Safaris Search field anymore.
This alone is just great, I was always a little bit envious towards Firefox for their choice of search engines in the Search box. But the better part of this is, that someone programmed a [Quicksilver Plugin][] that takes these AcidSearches and makes them available in Quicksilver as well:
Hit `⌘-Space`, followed by `Goo`, hit `Space` again and type your query, followed by `Enter` and you’ll get Googles results. It might sound complicated but it’s a lot faster than activating Safari, selecting the Search box by any means and then entering that query — especially if Safari’s not launched yet.
* * *
Of course, this whole thing has a drawback: AcidSearch knows nothing about the LaunchBar Search templates and entering all by hand can quickly become an annoying task.
Luckily, these queries are stored in `Configuration.plist` in the `~/Library/Application Support/LaunchBar 4/` folder. Luckily again, AcidSearch can import `plist`s in some well defined formats as well.
With the following short snippet of XSLT, you can convert your LaunchBar Search Templates to an AcidSearch compatible `plist that can be imported. This makes your entire collection of searches available to Quicksilver as well and will save you a lot of work:
<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
<xsl:output indent="yes"/>
<xsl:template match="/">
<plist version="1.0">
<array>
<string>ROOT</string>
<array>
<string>LaunchBar Import</string>
<xsl:apply-templates
select="//dict[child::string='ODLBSearchTemplatesRule']"/>
</array>
</array>
</plist>
</xsl:template>
<xsl:template match="dict">
<xsl:for-each select="array/dict">
<xsl:variable name="prefix">
<xsl:value-of
select="substring-before(
child::string[preceding-sibling::key='templateURL'],
'*')"/>
</xsl:variable>
<xsl:variable name="suffix">
<xsl:value-of
select="substring-after(
child::string[preceding-sibling::key='templateURL'],
'*' )"/>
</xsl:variable>
<dict>
<key>key</key>
<string></string>
<key>name</key>
<string>
<xsl:value-of
select="child::string[preceding-sibling::key='name']"/>
</string>
<key>prefix</key>
<string><xsl:value-of select="$prefix"/></string>
<key>shortcut</key>
<string></string>
<key>suffix</key>
<string><xsl:value-of select="$suffix"/></string>
</dict>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
If you download [lb2acid.xsl][], you can convert your own `Configuration.plist` and import it in AcidSearch. The imported SearchChannels will be available under “LaunchBar Import”, this way, you can more easily find and change/remove them if needed.
You’ll have to execute the following command in the Terminal, in the directory where you downloaded `lb2acid.xsl`:
xsltproc -o ~/Desktop/LaunchBar.plist \
lb2acid.xsl \
~/Library/Application\ Support/LaunchBar\ 4/Configuration.plist
Or, if you don’t want to download the XSL file and just be lazy:
xsltproc -o ~/Desktop/LaunchBar.plist \
http://mycvs.org/wp/wp-content/lb2acid.xsl \
~/Library/Application\ Support/LaunchBar\ 4/Configuration.plist
(You’ll have to enter the command on *one* line, obviously!)
If you do not have the `xsltproc` tool on your Mac, you might want to dowload it from the Mac OS X [LibXSLT][] port page. It’s available for free and makes a good addition to your system if you plan to tinker with XML/XSLT This is my electronic home with lots of different stuff about Mac's, the Life, Blogs, Quotes and more.
Leave a reply