I was looking for a way to quickly search different web sites from any application. I had already set up keyword searches in Chimera/Camino, but wanted that quick search functionality from any application.
Simply using AppleScript's open location command wouldn't pass my "gg search terms" to Chimera to search Google since it wasn't a formatted URL. So I wrote an AppleScript to call from LaunchBar. I can now hit Cmd-Spacebar to bring up LaunchBar, then type 'gg' to launch up my "gg Search Google" AppleScript via LaunchBar, type in my search terms and it will execute the search in my preferred browser.
The script:
-- Set site name and base search URL
set siteName to "Google"
set baseURL to "http://www.google.com/search?q="
-- Set default search terms
set inputText to ""
-- Display an input dialog
display dialog "Search " & siteName & " for:" default answer inputText ¬
buttons {"Cancel", "OK"} default button 2 giving up after 15
set inputText to the text returned of the result
-- Verify input data
if inputText is not "" then
-- Build the URL
set searchURL to baseURL & inputText as string
-- Perform search
open location searchURL
end if
By replacing the siteName and baseURL variables, several scripts can be created to search many different web sites. Personally I frequently use the following (each of these should be entered on one row with no spaces added):
http://www.google.com/search?q= http://search.yahoo.com/bin/search?p= http://m-w.com/cgi-bin/dictionary?va= http://search.ebay.com/search/search.dll?query= http://www.versiontracker.com/mp/new_search.m?productDB=mac&mode= Quick&OS_Filter=MacOSX&search= http://www.fedex.com/cgi-bin/tracking?action=track&language=english &cntry_code=us&mps=y&tracknumbers= http://wwwapps.ups.com/WebTracking/processInputRequest?HTMLVersion=5.0& sort_by=status&tracknums_displayed=1&TypeOfInquiryNumber=T&loc=en_US& AgreeToTermsAndConditions=yes&InquiryNumber1=Anyone else have any favorite search sites?
Mac OS X Hints
http://hints.macworld.com/article.php?story=20030309215427469