Mac Classic

Creating a Sherlock plugin

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.

Setting up a search engine

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.

  • Create an account with FreeFind
  • When prompted, choose the plan that suits your needs. The free plan has a index storage limit of 64MB which should be more than enough for most websites.
  • Once you've made your account you will receive an email, which will include the site ID number. Take note of this because it will need to be added to the plugin.
  • On the FreeFind website, click the 'Build Index' tab and begin indexing your website. You can also set up indexing schedules which is recommended if your content changes regularly.
Create a FreeFind account

Create a FreeFind account

Build an index of your website

Build an index of your website

Copy/adjust an existing plugin

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.

Description of the plugin structure

  • In the <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.
  • The input elements are where you specify the parameters of the search engine.
  • Within the <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.
    The resultItemStart and resultItemEnd attributes tell Sherlock which blocks of content are items/results to read text from. These are then displayed as Sherlock results.
  • Save your plugin.

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.

The response Sherlock receives behind the scenes

The response Sherlock receives behind the scenes

What Sherlock is processing from the FreeFind response (search results)

What Sherlock is processing from the FreeFind response (search results)

Installation of plugins

  • For Sherlock 1, put the plugins you want to use in the folder 'Internet Seach Sites' (HD > System Folder > Internet Seach Sites). Your installed plugins can be found under the Search Internet tab.
  • For Sherlock 2, Choose the channel that looks like a hat with a magnifying glass next to it, this is the My Channel channel. The channel should start populating itself with the latest available plugins automatically. If not you can manually add channels to the channel folders in the 'Internet Seach Sites' folder (HD > System Folder > Internet Seach Sites).

Post a Comment