I finally got around to generalizing the ability to "open URL in $browser" using a single keystroke -- that is, while running browser X, open the currently-viewed URL in browser Y. The services menu, unfortunately:
Part 1: The Scripts
Here's the AppleScript that handles grabbing the current URL and then passing it to the browser of choice:
tell application "System Events"
set myApp to name of first application process whose frontmost is true
if myApp is "Camino" then
tell application "Camino"
set myURL to URL of window 1
end tell
else if myApp is "firefox-bin" then
tell application "Firefox"
set myURL to «class curl» of window 1
end tell
else if myApp is "Opera" then
tell application "Opera"
set myInfo to GetWindowInfo of window 1
set myURL to item 1 of myInfo
end tell
else if myApp is "Safari" then
tell application "Safari"
set myURL to URL of document 1
end tell
else
return
end if
end tell
do shell script "open -a camino " & quoted form of myURL
(Note: Thanks to this forum thread for the Firefox solution.)
tell application "Terminal"
activate
do script "elinks " & quoted form of myURL
end tell
Also, Opera 9.x isn't AppleScript enabled by default (for now), so you have to add the following to its info.plist file:
<key>NSAppleScriptEnabled</key>
<string>Yes</string>
Finally, going from ELinks to a GUI browser is best handled within elinks itself. Here's the lua code to add to hooks.lua, e.g.:
function guiBrowser ()
os.execute("open " ..current_url ())
end
bind_key ("main", "X", guiBrowser)
Which will open in your default browser.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20060325015454467