Posted on Sat - September 9, 2006

Updated weather script


This version of my weather script is no longer dependent on my specific computers to run. It also checks for the Konfabulator widget folder before trying to launch those widgets. It pops up the weather maps, then shortly after moves the maps to the Users:Shared folder and quits Preview.

Since it is not as dependent on my specific setups, this script is shorter and faster than it's predecessor. There are some specific 10.4 elements in this script though, I don't think it will run under 10.3 without tweaking.

tell application "Finder"
if folder "Users:Shared:Widgets" of startup disk exists then
open file "Users:Shared:Widgets:The Weather.widget" of startup disk
open file "Users:Shared:Widgets:The Weather #2.widget" of startup disk
open file "Users:Shared:Widgets:The Weather #3.widget" of startup disk
open file "Users:Shared:Widgets:The Weather #4.widget" of startup disk
open file "Users:Shared:Widgets:The Weather #5.widget" of startup disk
end if
end tell
set temperature_map to "acttemp_720x486.jpg" -- temperatures
set weather_map to "curwx_720x486.jpg" -- surface isobars
set channel_URL to "http://maps.weather.com/images/maps/current/"
set the target_URL to channel_URL & temperature_map
set the destination_file1 to ((path to desktop as string) & "tempermap.jpg")
tell application "URL Access Scripting"
download target_URL to file destination_file1 replacing yes
end tell
set the target_URL to channel_URL & weather_map
set the destination_file to ((path to desktop as string) & "weathermap.jpg")
tell application "URL Access Scripting"
download target_URL to file destination_file replacing yes
end tell
tell application "Preview"
open alias destination_file
open alias destination_file1
delay 33
quit
end tell
tell application "Finder"
move file "Desktop:weathermap.jpg" of home to folder "Users:Shared" of startup disk with replacing
move file "Desktop:tempermap.jpg" of home to folder "Users:Shared" of startup disk with replacing
end tell

www.teknopagan.com
       



teknologi
© 2005 - 2008 All Rights Reserved