Sherlock plug-in available for macosxhints

May 08, '02 11:35:21PM

Contributed by: robg

Inspired by Macintouch's recent Sherlock search plug-in, I decided to try to write one for macosxhints.com. Having never looked at Sherlock plug-ins before, it took a bit of trial and error before I got something working, but eventually, I wound up with something that mostly works. If you'd like to try it out, just:

  1. Download the plug-in and let Expander expand it.
  2. Take the resulting macosxhints.src file and drag it into the Internet folder withing the Internet Search Sites folder, which is inside your user's Library folder.
  3. Launch Sherlock and select the Internet channel and then unselect all plug-ins other than the one for macosxhints.
  4. Due to limitations in the current search engine, you can only search for phrases; "foo bar" runs a search for the phrase "foo bar", not occurences of either "foo" or "bar". So limit your searches to one or two words ("Classic" instead of "OS 9 Classic compatibility").
  5. The results list will list all hints (not comments) which contain your search phrase; double-click any result to load the actual web page.
You may see an occasionally odd result, but it mostly seems functional. If you'd like to see the source for the plug-in, just read the rest of the article. And if you have ideas for improvements, please feel free to modify the script and email it back to me -- I'll put enhanced versions online.

I have plans to make one for the forum site as well, but the search engine there is a bit more troublesome (it goes through an intermediate step which I can't quite decode yet).

I read Apple's technote 1141, Extending and Controlling Sherlock to learn the Sherlock plug-in syntax, and then just started experimenting. This is what I came up with:

<SEARCH
name = "macosxhints.com"
method = "get"
action = "http://www.macosxhints.com/search.php"
description = "Search published hints on macosxhints.com">

<INPUT
name = "query"
user>

<INPUT
name = "datestart"
value = >

<INPUT
name = "dateend"
value = >

<INPUT
name = "topic"
value = "0">

<INPUT
name = "type"
value = "stories">

<INPUT
name = "author"
value=>

<INPUT
name = "mode"
value = "search">

<INTERPRET
resultListStart = "Hits</th><tr align=center>"
resultListEnd = "</td></tr></table></td><
/tr></table></td></tr></table>"
resultItemStart = "<td align=left>"
resultItemEnd = "<tr align=center>">

</SEARCH>
The resultListEnd item has been broken onto two lines for easier readability. The only trick in creating the plug-in is that the file type must be 'issp', which I did with SetFileInfo in the Terminal. TextEdit has no problem opening or editing these file types.

I'm certain this script can be improved; if you have Sherlock plug-in experience, feel free to let me know what can be done better!

Comments (4)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20020508233521409