Weather Underground Script for Canada?

Posted on
Wed Aug 15, 2012 10:58 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Weather Underground Script for Canada?

Long shot I know but might anyone know of a way to get the temperature, using the Weather Underground
site, for Canadian postal codes, or possibly weather station codes?

I have a number of webcam CP's setup that is nice to also show the local temperatures.

I use this script to pull the temps from US zipcodes into variables, and am hoping for a way to
use it for Canada as well.

Code: Select all
--Get Temperature
set the_temp to do shell script "curl http://api.wunderground.com/api/28fc850a3c5ed668/conditions/q/60644.json | grep temp_f"
try
   set oldDelims to AppleScript's text item delimiters -- save their current state
   set AppleScript's text item delimiters to {":"} -- declare new delimiters
   set temp_item to the text items of the_temp
   set this_item to item 2 of temp_item
   set AppleScript's text item delimiters to {","}
   set temp_item to the text items of this_item
   set AppleScript's text item delimiters to ""
   set the_temp to temp_item as text
   set AppleScript's text item delimiters to oldDelims -- restore them
on error
   set AppleScript's text item delimiters to oldDelims -- restore them in case something went wrong
end try
the_temp --
set the_temp to round (the_temp)

tell application "IndigoServer"
   set the value of variable "WCtempBA" to the_temp
end tell


I tried substituting the zipcode for instance, with the Banff postal code which of course wouldn't work.

Any ideas greatly appreciated.

Thanks,

Carl

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 28 guests