19 July 2021
If you haven't read about the Sherlock's 2021 revival make sure you check it out. Creating a plugin today is a little limited due to early Mac OS not being able to decipher any HTTPS protocols, and no web browsers supporting HTTPS. You need to have a website that is accessible over HTTP, and is viewable on older web browsers.
The easiest and fastest way to create a plugin is to copy an existing one rather than starting from scratch. If you'd like more technical information on building plugins, see the Apple Technical Notes at the bottom of this page.
You will need to find a search engine that supports HTTP requests and responses. FreeFind is an ideal candidate because they don't enforce HTTPS encryption.
Copy an existing plugin from the Macintosh Garden mega-pack, or download our plugin as an example. Open the plugin with a text editor such as BBEdit. Otherwise if you're starting completely from scratch with a text editor, you'll need to ensure you save the document with the correct file type. Open the saved plugin with ResEdit and go under the File menu to "Get File/Folder Info..." you'll then need to change the type to "issp" and the creator to "fndf". This allow Sherlock to recognise your plugin.
An example plugin:
# Sherlock Plug-in for Mac-Classic.com
# Built 13 may 2021 by Greystash
<search
name="Mac Classic"
description="Search Mac-Classic.com for useful guides, information and software."
action="http://search.freefind.com/find.html"
method="get"
routeType="misc"
update="http://mac-classic.com/downloads/sherlock-plugins/mac-classic.src.hqx"
updateCheckDays="1"
>
<input type="hidden" name="si" value="76721850">
<input type="hidden" name="pid" value="r">
<input type="hidden" name="n" value="0">
<input type="hidden" name="_charset_" value="">
<input type="hidden" name="bcd" value="Ö">
<input type="text" name="q1" user>
# -- Format the search output here --
<interpret
resultListStart = "<main>"
resultListEnd = "</main>"
resultItemStart = '<font class="search-results" face="arial,verdana,geneva,lucida" size="-1">'
resultItemEnd = "</font>"
>
</search>
# --- end of plug-in ---
<input name="query" user />
Edit the <input>
attribute with the site ID e.g. <input type="hidden" name="si" value="76721850">
and replace it with your one.
<search>
block of code the action
attribute tells Sherlock to submit a search engine request to freefind.com. The update
attribute tells Sherlock to check for an updated version of the plugin at this location.input
elements are where you specify the parameters of the search engine.<interpret>
element, the resultListStart
and resultListEnd
attributes tell Sherlock where to begin reading the document/search results. See the example image of Freefind's search results/the response given to Sherlock.resultItemStart
and resultItemEnd
attributes tell Sherlock which blocks of content are items/results to read text from. These are then displayed as Sherlock results.Note: When saving your plugin, make sure it's all one word e.g. macclassic.src. Plugins with dashes etc. in the name can cause issues with Sherlock.
Post a Comment