Google Chrome のタブを Safari で開く Apple Script について
Apple Script の勉強も兼ねて、Google Chrome のタブを Safari で開く Apple Script と
Safari のタブを Google Chrome で開く Apple Script を作りました。
Safari のタブを Google Chrome で開く Apple Script は、期待通りにいきましたが、
Google Chrome のタブを Safari で開く Apple Script が、うまくつくれません。
Google Chrome のタブをSafari で開くことは成功したのですが、バックグラウンド(前面でないタブ)で開いてしまいます。
Google Chrome のタブをSafari で開き、アクティブ(開いたタブを選択状態)にしたいのですが、どこをどうしたらいいのでしょうか?
Google Chrome のタブを Safari で開く Apple Script
tell application "Google Chrome"
set vURL to get URL of active tab of first window
end tell
tell application "Safari"
if windows ≠ {} then
makenewtabat the end of window 1 with properties {URL:vURL}
else
makenewwindow
set URL of (current tab of window 1) to vURL
end if
activate
end tell
tell application "Google Chrome"
tell active tab of first window to close
end tell
tell application "Safari"
activate
end tell
やりたいことは、
- Google Chrome のタブのURLを取得。
- Safari で取得したURLを開く。
- Google Chromeのタブを閉じる。
- Safari 開いたタブを前面に表示する。
です。
Safari のタブを Google Chrome で開く Apple Script
tell application "Safari"
set vURL to URL of current tab of window 1
end tell
tell application "Google Chrome"
if windows ≠ {} then
makenewtabat the end of window 1 with properties {URL:vURL}
else
makenewwindow
set URL of (active tab of window 1) to vURL
end if
activate
end tell
tell application "Safari"
tell current tab of first window to close
end tell
tell application "Google Chrome"
activate
end tell
やりたいことは、
- Safari のタブのURLを取得。
- Google Chrome で取得したURLを開く。
- Safari のタブを閉じる。
- Google Chrome 開いたタブを前面に表示する。
です。
Apple Script 初心者なので、こうした方がいいというような事も教えていただけるとうれしいです。
ご教授お願いいたします。
MacBook Pro, OS X Mountain Lion (10.8.3), Mid 2010