AppleScriptでSafariのwebarchiveを保存したい
サファリでURLにアクセスしてwebarchiveを保存するAppleScriptを作りました。
下記「delay 2」の部分を、きちんとURLが開くまで判断して待つようにできないでしょうか?
又、もう少しスマートな方法(UIのシステムイベントをなるべく使わない)で、webarchiveの保存ができないものでしょうか?
set the target_URL to "http://www.goo.ne.jp/"
set save_nam to "abc"
tellapplication "Safari" tomakenewdocumentwith properties {URL:target_URL}
tellapplication "Safari" toactivate
--
-- URLで判断したいが方法がわからない
delay 2
--
tell application "System Events"
tell process "Safari"
keystroke "s" usingcommand down -- Save As…
repeatuntilsheet 1 ofwindow 1 exists
delay 0.1
endrepeat
keystroke "d" usingcommand down -- save to Desktop
keystrokesave_nam -- set save file name
repeat
delay 0.1
ifnot (existssheet 1 ofwindow 1) thenexitrepeat
endrepeat
endtell
endtell
PowerMac G5-OTHER, Mac OS X (10.4.11)