Search macosxhints from the command line
Aug 01, '02 09:01:53AM
Contributed by: Anonymous
A simple hint, based on the Search VersionTracker hint. Here's how to rework the script to search macosxhints.com from the command line:
#!/usr/bin/perl -w
$browser = "Mozilla";
print "Search string: ";
$keyword = <STDIN>;
chomp($keyword);
$url = "http://www.macosxhints.com/search.php?query=".$keyword."&
mode=search&datestart=0&dateend=0&topic=0&type=stories&author=0";
$todo = "\'Tell application \"$browser\" to OpenURL \"$url\"\'";
system("osascript -l AppleScript -e $todo");
NOTE: The $url line has been broken into two lines for display purposes; enter it on one line with no spaces.
You must modify the script if you use a different browser. "Explorer" instead of "Mozilla" and getURL instead of OpenURL. Read the other hint and the comments for more details on creating and saving this script. But this works like a charm for me in Mozilla.
[Editor's note: To extend the concept in these two hints to any searchable site, just visit the site in question and execute a search. Copy the URL from the results page and then use that in the "$url" line. Replacing your test search term in the URL with the reference to $keyword as shown in the two hints, and you have an instant command-line search tool for that particular website.]
Comments (5)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20020801090153686