I find the weather script that comes with Indigo a bit lacking, and at times a little slow. Also, I prefer using the weather feed from Yahoo since it matches up to the weather widget in my dashboard.
You’ll first need to get the right parameter for your local weather. Go to Yahoo Weather and type in your city/zip code. Just look at the URL and you should have something like: http://weather.yahoo.com/forecast/USGA0028.html
Grab what comes after ‘forecast/’ and before ‘.html’ and replace ‘USGA0028′ in the script below.
property fetchTimeout : 15 -- don't wait for query response for more than 15 seconds...
try
with timeout of fetchTimeout seconds
do shell script "curl -s 'http://xml.weather.yahoo.com/forecastrss?p=USGA0028' | grep -E '(<yweather:condition|/\\>)' | sed -e 's/^.*temp=\"//' -e 's/\".*$//'"
set temperature to result
do shell script "curl -s 'http://xml.weather.yahoo.com/forecastrss?p=USGA0028' | grep -E '(<yweather:condition|/\\>)' | sed -e 's/^.*text=\"//' -e 's/\".*$//'"
set conditions to result
do shell script "curl -s 'http://xml.weather.yahoo.com/forecastrss?p=USGA0028' | grep -E '(<yweather:forecast day=\"|/\\>)' | sed -e 's/^.*high=\"//' -e 's/\".*$//' -e 'q'"
set high to result
do shell script "curl -s 'http://xml.weather.yahoo.com/forecastrss?p=USGA0028' | grep -E '(<yweather:forecast day=\"|/\\>)' | sed -e 's/^.*low=\"//' -e 's/\".*$//' -e 'q'"
set low to result
tell application "IndigoServer"
if not (variable "weatherTemperature" exists) then
make new variable with properties {name:"weatherTemperature", value:temperature}
else
if value of variable "weatherTemperature" is not temperature then
set value of variable "weatherTemperature" to temperature
end if
end if
if not (variable "weatherConditions" exists) then
make new variable with properties {name:"weatherConditions", value:conditions}
else
if value of variable "weatherConditions" is not conditions then
set value of variable "weatherConditions" to conditions
end if
end if
if not (variable "weatherTemperatureHigh" exists) then
make new variable with properties {name:"weatherTemperatureHigh", value:high}
else
if value of variable "weatherTemperatureHigh" is not high then
set value of variable "weatherTemperatureHigh" to high
end if
end if
if not (variable "weatherTemperatureLow" exists) then
make new variable with properties {name:"weatherTemperatureLow", value:low}
else
if value of variable "weatherTemperatureLow" is not low then
set value of variable "weatherTemperatureLow" to low
end if
end if
end tell
end timeout
end try
« Adjusting the Climate upon Leaving and Restoring Previous Settings upon Return Half-Off Depot ‘Notify When Back In Stock’ »

Hi,
I am trying to get this to work for UK cities? The code I an putting in for Darlington UK is: UKXX0817
Am I doing something wrong as I can’t get it to work.
Thanks for any help- Chris.
Hi Hunter,
Sorry, I should have mentioned the error I am getting when running it in script editor is 51. The script itself works great as I have it set up in indigo with the weather icons updating perfectly, I think it is something about the web address it doesn’t like.
Thanks again for your help- Chris.