property LastLine : ""
on idle
-- 産経webからニュースを取得
set gT to do shell script "curl http://www.sankei.co.jp/news/sokuhou/sokuhou.html"
set theText to do shell script "echo " & quoted form of gT & " | perl -pe '~ s/<[^<]*>//g; s/\015\012/\n/g; s/\015/\n/g; s/\s*\n+/\n/g; s/[0-9]{2,}:[0-9]{2,}//g;'" -- タグ処理
set newsLine to paragraph 4 of theText
if newsLine is "" then
set newsLine to paragraph 5 of theText
end if
-- もしニュースが更新されていれば以下を実行
if newsLine is not LastLine then
set newsNotification to {"Sankei News"}
tell application "GrowlHelperApp"
register as application "News Headline" all notifications newsNotification default notifications newsNotification icon of application "Script Editor.app"
notify with name "Sankei News" title "News" description newsLine application name "News Headline"
end tell
set LastLine to newsLine
end if
return 10 * minutes -- 10分おきにチェック
end idle
set wakeupTime to "0800" -- 作動させる時間&分
set PL to false
set VL to 2
on idle
global wakeupTime, PL, VL
set nowDate to do shell script "date +'%H%M'" as text
if (nowDate is wakeupTime) and not PL then
tell application "Finder" to set volume 2
-- iTunesを起動し、曲を再生するか、open location "http://〜〜" でストリーム再生
tell application "iTunes" to 〜〜
-- 5分おきに音量を上げて、音量が6になったら終わり
set PL to true
return 5 * minutes
else if (VL = 2) and (PL) then
tell application "Finder" to set volume 3
set VL to 3
return 5 * minutes
else if (VL = 3) and (PL) then
tell application "Finder" to set volume 4
set VL to 4 return 5 * minutes
else if (VL = 4) and (PL) then
tell application "Finder" to set volume 6
quit
else
return 10
end if
end idle
tell application "RealOne Player"
activate
GetURL "http://www.nhk.or.jp/rj/ram/jp/japanese.ram"
end tell
・monzaiを利用してSafariで開いているページを日本語で読み上げる