(* このスクリプトは、現在Safariで開いている全ページを、指定したブラウザで一気に開きます。 利用したいwebブラウザをアクティブにして、Safari_to_Other.scptを実行します。 全てのページを一つの新規ウィンドウを開いて表示します。 最前面のSafariウィンドウのみに限定することができます。(デフォルト) このスクリプトを動かすために必要なもの AppleScriptライブラリ 依存するAppleScriptライブラリを以下のページからダウンロードしておく必要があります。 https://github.com/zarigani/AppleScript-bebe-s-Library/tree/master そして、以下のファイルをユーザースクリプトフォルダ(~/Library/Scripts)にインストールしてください。 _lib.scpt _gui.scpt *) property GUI : load script file ((path to scripts folder as text) & "_gui.scpt") property LIB : load script file ((path to scripts folder as text) & "_lib.scpt") --実行時に最前面のアプリケーションを保存する set app_name to GUI's frontmost_process() --Safariで開いているページのリストを取得する tell application "Safari" activate delay 0.5 set top_win to window 1 set tab_names to top_win's tab's name set tab_names to "◆" & LIB's join(tab_names, return & "◆") "Safariで表示中のページを、" & app_name & "で開きます。" & return & return & tab_names display alert result buttons {"キャンセル", "全ウィンドウの全タブを開く", "最前面の上記タブのみ開く"} cancel button 1 default button 3 giving up after 30 if result's button returned = "最前面の上記タブのみ開く" then set window_tab_urls to {top_win's tab's URL} else if result's button returned = "全ウィンドウの全タブを開く" then set window_tab_urls to windows's tab's URL else error number -128 end if end tell --空のリストとTop Siteを除外する repeat with tab_urls in window_tab_urls if tab_urls's number > 0 then set tab_urls's contents to LIB's reject_if(tab_urls, "topsites://") end if end repeat --さらに、Top Siteを除外した結果、空になったリストを除外する set window_tab_urls to LIB's reject_if(window_tab_urls, {}) --シングルクォートしたスペース区切りのURLテキストを生成する set url_options to "'" & LIB's join(window_tab_urls, "' '") & "'" --中身が存在すれば新規ウィンドウを開いて表示する if url_options ≠ "''" then tell application app_name to activate delay 0.5 GUI's shortcut("", "command-N") delay 0.5 do shell script ("open -a " & app_name & space & url_options) end if