Googling

| | Comments (0)
I took the demo Google API script and modified it to work to my needs. First, I made it pop up a dialog asking for search terms using MacPerl::Ask(). I reorganized it slightly, and added simple XML escaping (so I could search for "A&E"). Then I made a Template to output an HTML file, and used Mac::InternetConfig::GetURL() to open the file in my browser.

The result is this. A web page that looks how I want it to look. And since I can execute the script from any program with cmd-opt-shift-] (using OSAMenu), it is very convenient.

Sure, I could just have the script do GetURL("http://www.google.com/search?query=$searchterms"), but where is the fun in that? Plus, I could extend this to do a more elaborate dialog box, which would include a list of available search engines (using WWW::Search, perhaps), and a Google-like option to merely open the first returned site directly.

NOTE: MacPerl has a bug or two in it that prevents installing Template through normal means. Will be fixed in next release (necessary patches for MacPerl and for Template have been submitted). use.perl.org

Leave a comment

<pudge/*> (pronounced "PudgeGlob") is thousands of posts over many years by Pudge.

"It is the common fate of the indolent to see their rights become a prey to the active. The condition upon which God hath given liberty to man is eternal vigilance; which condition if he break, servitude is at once the consequence of his crime and the punishment of his guilt."

About this Entry

This page contains a single entry by pudge published on April 19, 2002 7:29 AM.

UTF8 Goodness! was the previous entry in this site.

makeslides is the next entry in this site.

Find recent content on the main index or look in the archives to find all content.