Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!

A web search script for LaunchBar Apps
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?
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[5,831 views]  

A web search script for LaunchBar | 7 comments | Create New Account
Click here to return to the 'A web search script for LaunchBar' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
A web search script for LaunchBar
Authored by: Spartacus on Wed, Mar 12 2003 at 11:16AM PST
> Anyone else have any favorite search sites?

Yes, AllTheWeb.com

http://www.alltheweb.com/search?cat=web&cs=iso-8859-1&_sb_lang=en&q=

Probably cs must be tweaked. Does the script replace spaces with +'s?

[ Reply to This | # ]
A web search script for LaunchBar
Authored by: Han Solo on Wed, Mar 12 2003 at 1:45PM PST
I confess: I know next to nothing about coding in Apple Script. But a cool modification to this code would be a drop-down menu of possible (pre-coded) sites; the user selects one, which would execute the appropriate search string. Possible?

[ Reply to This | # ]
A web search script for LaunchBar
Authored by: swgs on Wed, Mar 12 2003 at 2:00PM PST
deffinitely possible. With today's applescript, you can make entire applications out of it.

[ Reply to This | # ]
A web search script for LaunchBar
Authored by: ptb@mac.com on Wed, Mar 12 2003 at 2:53PM PST
I'm sorry, I was the original submitter of this story, but I left out the most important one of all!
http://www.macosxhints.com/search.php?type=stories&mode=search&query=


[ Reply to This | # ]
A complete & configurable solution
Authored by: TomAnthony on Thu, Mar 13 2003 at 8:47AM PST
Those of you interested in this cool tip, may be interested in an upcoming product from Ambrosia Software:

http://www.ambrosiasw.com/news/upcoming/iseek_betashots.html

[ Reply to This | # ]
A "better" web search script for LaunchBar
Authored by: webentourage on Thu, Mar 13 2003 at 4:27PM PST
I've written a quick application named SearchApp does this and more. It has a drop-down menu that lists other search engines. You don't have to mess with any code. It also has a nice editor so you can add more search engines. It's free and available at http://www.webentourage.com/searchapp.php

[ Reply to This | # ]
A "better" web search script for LaunchBar
Authored by: WCityMike on Sat, Mar 15 2003 at 11:26PM PST
Check out Huevos, by Ranchero Software.

[ Reply to This | # ]