property theURL : ""
tell application "Safari"
set theURL to URL of current tab of window 1
end tell
tell application "System Events" to set procList to (name of every process)
if (procList contains "Google Chrome") then
tell application "Google Chrome"
if exists window 1 then
tell window 1 to make new tab with properties {URL:theURL}
activate
else
make new window
set URL of active tab of window 1 to theURL
activate
end if
end tell
else
tell application "Google Chrome"
if exists window 1 then close
set URL of active tab of window 1 to theURL
activate
end tell
end if
Now, to handle drag-and-dropped links to the dock icon, I tweaked this script to accept drag-and-dropped links. First save this script as an application.
on open theURL
tell application "System Events" to set procList to (name of every process)
if (procList contains "Google Chrome") then
tell application "Google Chrome"
if exists window 1 then
tell window 1 to make new tab with properties {URL:theURL}
else
make new window
set URL of active tab of window 1 to theURL
end if
end tell
else
tell application "Google Chrome"
if exists window 1 then close
set URL of active tab of window 1 to theURL
end tell
end if
end open
tell application "Google Chrome" to activate
Next, Get Info on Google Chrome, then select and copy its icon. Get info on the application script you just saved, select its icon and paste Chrome's icon over it. Now put this script in the dock in place of Google Chrome. It will still launch Chrome if you click/double-click it without dragging a link onto it.
on open theWebloc
tell application "Finder" to set theURL to location of internet location file (theWebloc as text)
tell application "System Events" to set procList to (name of every process)
I'm calling it done.
property theURL : "" tell application "Safari" set theURL to URL of current tab of window 1 end tell do shell script "/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome " & theURLposted by pmbuko at 2:13 PM on April 14, 2011