Top / AppleScript
●新規ウィンドウでURLを開く
tell application "iCab" to OpenURL "http://homepage.mac.com/abemak/" toWindow 0
●新規タブでURLを開く
tell application "iCab"
OpenURL "http://www.tcp-net.ad.jp/danbo/" toWindow 0 -- MACお宝鑑定団
OpenURL "http://mac.page.ne.jp/" toWindow -2 -- 新しもの好きダウンロ〜ド
OpenURL "http://mactree.sannet.ne.jp/" toWindow -2 -- MacTree
OpenURL "http://www.applelinkage.com/" toWindow -2 -- Apple Linkage
end tell
●日付を含むURLを開く
set day1 to (current date) - days
set day2 to day1 - 6 * days
set dd to 1 as number
set tmpday to day1
tell application "iCab" to OpenURL "http://www.unitedmedia.com/comics/peanuts/archive/index.html" toWindow 0
set baseURL to "http://www.unitedmedia.com/comics/peanuts/archive/peanuts-"
-- The Official Peanuts Website
repeat
set hiduke to tmpday as string
if (word 3 of hiduke as number) < 10 then
set mtmp to "0" & word 3 of hiduke
else
set mtmp to word 3 of hiduke
end if
if (word 5 of hiduke as number) < 10 then
set dtmp to "0" & word 5 of hiduke
else
set dtmp to word 5 of hiduke
end if
set hidukeString to (word 1 of hiduke & mtmp & dtmp)
tell application "iCab" to OpenURL (baseURL & hidukeString & ".html") toWindow -2
set tmpday to tmpday - dd * days
if (day2 - tmpday) > 0 then exit repeat
end repeat
●最前面のページのアドレスをコピー
電子メールや掲示板などにWebページのアドレスを書くときに便利かも。以下のスクリプトでは、タイトルの頭に「●」を付けたりしてますが、好みに合わせて変更するといいでしょう。
tell application "iCab"
tell front window
set thePageName to name
set thePageURL to URL
end tell
-- 上の4行の代わりに以下の4行のような書き方もできます
-- tell (GetWindowInfo -1)
-- set thePageName to item 2
-- set thePageURL to item 1
-- end tell
end tell
set the clipboard to "●" & thePageName & return & tab & thePageURL & return
●新規ウィンドウに表示したページを保存
tell application "iCab"
Activate -- なくてもよさそうだけど、スクリプトがうまく動作しない
OpenURL "http://news.google.co.jp/" toWindow 0 -- Google ニュース 日本版
set theName to (date string of (current date)) & ".icab"
set thePath to ((path to desktop) as string) & theName
-- デスクトップに日付を名前に,拡張子のicabは勝手に決めたもので、zipでもなんでもいいです
tell application "Finder" to make file at desktop with properties {name:theName, creator type:"iCAB", file type:"ZIP・"}
-- 上の文は、なくてもよさそうだけど動かないので
save (document 1 of front window) in thePath as "ZIP・"
-- このファイルはzip圧縮ファイルを扱えるソフトウェアで閲覧・解凍できます
-- まれにクリエータやファイルタイプがうまく設定されないことがありますが
-- それぞれ「iCAB」,「ZIP・」に変更すればいいです(データの保存自体はうまくいっている)
-- 「ZIP・」のところを「TEXT」にするとふつう (HTMLではなく) のテキストで保存される
end tell
Top / AppleScript