Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,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 2.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[8,804 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 whoever posted them. This site is not responsible for what they say.
A web search script for LaunchBar
Authored by: Spartacus on Mar 12, '03 11:16:12AM

> 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 Mar 12, '03 01:45:12PM

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 Mar 12, '03 02:00:13PM

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 Mar 12, '03 02:53:19PM
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 Mar 13, '03 08:47:38AM
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 Mar 13, '03 04:27:26PM
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: Anonymous on Mar 15, '03 11:26:50PM
Check out Huevos, by Ranchero Software.

[ Reply to This | # ]