i find that i tend to use netnewswire as often as i do safari, both of which use the system-wide flash instance. this applescript checks which of those two is the frontmost application and opens the current url in chrome. i'm an applescript newbie, so any improvements are more than welcome :)
Code: Select all
tell application "LaunchBar" to hide
tell application "System Events" to set currentApplication to name of 1st application process whose frontmost is true
set currentURL to getCurrentURL(currentApplication)
if currentURL is not "" then
tell application "Google Chrome"
activate
if (exists window 1) and (URL of active tab of window 1 is "chrome://newtab/") then
tell window 1 to set URL of active tab to currentURL
else
open location currentURL
end if
end tell
end if
on getCurrentURL(currentApp)
if currentApp = "Safari" then
tell application "Safari" to set currentURL to URL of current tab of window 1
else if currentApp = "NetNewsWire" then
tell application "NetNewsWire"
set allURLs to URLs of tabs
set currentURL to item (index of selected tab + 1) of allURLs
end tell
else
currentURL = ""
end if
return currentURL
end getCurrentURL
if you use other browsers that use the system-wide flash instance, add your applescript code to getCurrentURL(currentApp).
cheers,
mbotta