I'm new to use Applescript to create services in Snow Leopard. I found myself often trying to open a link in Safari with Firefox. I know there are ways to open a page url with FF but I want to open any link inside a page with FF. I think using Applescript to create a service might be a good idea and so far I found this:
openFirefoxURL("http://www.apple.com/")
on openFirefoxURL(x)
return do shell script "open -a Firefox" & space & quoted form of x
end openFirefoxURL
This creates a new tab in FF nicely. Any advice to adapt it to open a link on a page?
UPDATE: I found a solution through trial and error:
tell application "Safari"
set myURL to (do JavaScript "(getSelection().anchorNode.parentNode.href)" in document 1)
end tell
do shell script "open -a Firefox" & space & myURL
Now that the script serves my purpose, I don't know if there are better ways to do it, e.g. getting the selection via Applescript rather than javascript. Let me know if you have better solutions. Thanks!