週間天気予報を表示させるAppleScript
週末のお出かけに天気や気温などをさっと確認したくて作りました。
property tenki_rss : ""
if tenki_rss = "" then
activate me
display dialog "Weather Hacks RSS" default answer "http://weather.livedoor.com/forecast/rss/23/38.xml"
set tenki_rss to text returned of result
else
do shell script "curl " & tenki_rss & " | grep '<description>' | sed -e 's/<description>//g'| sed -e 's@</description>@@g' | sed -e 's@</image>@@g'"
display dialog result buttons {"reset", "OK"} default button 2
set reset_button to button returned of result
if reset_button = "reset" then set tenki_rss to ""
end if
初回起動時にはRSSの入力が求められますのでWeather Hacksのページからお住いの地域のRSSを取得してコピペしてください。
間違えて入力しちゃったり、表示させる地域を変更したい場合は「reset」をクリック。
例よってLaunchBarの文字を大きく表示させる機能「Large Type」を利用して表示するとこんな感じ。
property tenki_rss : ""
if tenki_rss = "" then
display dialog "Weather Hacks RSS" default answer "http://weather.livedoor.com/forecast/rss/23/38.xml"
set tenki_rss to text returned of result
else
do shell script "curl " & tenki_rss & " | grep '<description>' | sed -e 's/<description>//g'| sed -e 's@</description>@@g' | sed -e 's@</image>@@g'"
tell application "LaunchBar"
display in large type result with title "週間天気予報"
end tell
end if