クリップボード内の先頭がhttpではじまる文字列を全部chromeで開くAppleScript
ちょっとメンドクサイ事態がおきたので作る。
アプリとして保存しておいて、クリップボードにコピった後に起動すると、chromeが開く。
タブ開き過ぎるとメモリ食うよね。
ブクマで保管するにしても管理メンドクサイし。
そこはエディタでさくさくやりたいという妙な人向け。
この逆で、chromeのタブを全部クリップボードに格納するものは前に作った。
Safari版;http://d.hatena.ne.jp/kinneko/20110126/p19
chrome版:http://d.hatena.ne.jp/kinneko/20120113/p21
今でも、この日記用に活躍中。
Trim関数がないので、行頭からhttpではじまらない場合は無視、という仕様。
(* open chrome tabs from clipboad kinneko@gmail.com 2013.12.17 *) set clipData to "" set clipLine to "" set firstFourUrl to "" set clipList to {} set urlList to {} -- クリップボードの内容の取り込み try set clipData to (the clipboard) as text end try -- CR区切りのリストに変換 set defaultDelimit to AppleScript's text item delimiters set AppleScript's text item delimiters to return set clipList to every text item of clipData set AppleScript's text item delimiters to defaultDelimit repeat with clipLine in clipList -- 行頭の空白除去 未実装 -- clipboardから拾ったものがhttpではじまるかどうか調べる try set firstFourUrl to (characters 1 thru 4 of clipLine) as string on error set clipLine to "" end try if firstFourUrl is not "http" then set clipLine to "" end if if clipLine is not "" then copy clipLine to the end of urlList end if end repeat set maxLines to {count item of urlList} if maxLines is 0 then quit me end if try tell application "Google Chrome" activate set aWin to make new window with properties {mode:"normal"} tell aWin set tabNum to 1 repeat with goToUrl in urlList if tabNum is 1 then tell tab tabNum set URL to goToUrl end tell else set newTab to make new tab with properties {URL:goToUrl} end if set tabNum to tabNum + 1 end repeat end tell end tell end try