AppleScript - 今天天氣哈哈哈

本區專門提供 Mac OS X 使用者交換使用心得

版主: ross_ttbryanchangdigdogchester

回覆文章
內容
發表人
留言五百如一日
文章: 610
註冊時間: 12/25/2001 1:01 am

AppleScript - 今天天氣哈哈哈

#1 文章 »

The following script using "URL Access Scripting" to download 天氣圖, one is a satellite image of pacific area from [url=http://www.weather.com;]www.weather.com;[/url] another one is a weather chart from hongkong observator. After finishing download, the Finder will open these files.

-- script start --

-- satellite image from www.weather.com
set the dFile1 to ((path to desktop as string) & "asia.jpg")
-- weather chart from hongkong observator
set the dFile2 to ((path to desktop as string) & "HKO.gif")

with timeout of 300 seconds
tell application "URL Access Scripting"
try
-- keep the following code in one line
download "http://maps.weather.com/images/sat/asiasat_720x486.jpg" to file dFile1 replacing yes
-- keep the above code in one line
end try
try
-- keep the following code in one line
download "http://www.weather.gov.hk/wxinfo/currwx/wxcht05.gif" to file dFile2 replacing yes
-- keep the above code in one line
end try
end tell
end timeout

tell application "Finder"
try
open alias dFile1
end try
try
open alias dFile2
end try
end tell

-- script end --
頭像
janusng
嗜冰客
文章: 1048
註冊時間: 04/30/2001 1:01 am
來自: Metropolis Asylum
聯繫:

AppleScript - 今天天氣哈哈哈

#2 文章 janusng »

悲兄:可否留下聯絡辦法給我?
我的Profile上有我的聯絡資料。

<A HREF="mailto:janusng@mac.com">janusng@mac.com</A>
ICQ: 7810967
回覆文章