One of my favorite productivity apps is Butler. While the "Which launcher app is better?" debate will rage interminably, I especially like Butler's ability to perform web searches simply via a keyboard shortcut activated pop-up bezel interface. All I have do to is hit Command-Option-Control-G, and a bezel box opens, allowing me to perform a Google search no matter what app I'm in. Ditto for -M and Google maps, -V and Version Tracker, etc.
I found myself wanting the ability to assign a simple keyboard shortcut, get a dialog box, and open any URL I wanted -- no reaching for my browser. While Butler contains a way to do this, it generally requires a step or two more than I'd like, and I wanted a more direct solution. Using one of Butler's most powerful features -- the ability to execute any AppleScript code with only a keyboard shortcut -- I implemented the following code:
display dialog "URL?" default answer "" buttons {".net", ".org", ".com"} default button 3
set {text returned:theURL, button returned:theDomain} to result
if theURL is "" then error number -128 -- cancel
if (offset of "." in theURL) is 0 then
-- This works for other domains, as long as no subdomains are entered
set theURL to theURL & theDomain
end if
if theURL starts with "www." then
set theURL to "http://" & theURL
else if theURL does not start with "http://www." then
set theURL to "http://www." & theURL
end if
tell application "Safari"
activate
open location theURL
end tellMac OS X Hints
http://hints.macworld.com/article.php?story=20070602121144514