Here's my final weatherman script. I use it within WeathermanX, not within Indigo. Weatherman has the option to run a script based on certain situations. However there's no reason you couldn't set up a time date trigger to fire this off ever so often.
The variable names have changed because I may get my weather data from another source in the future. It also creates variable for the forecast. Every script I write that needs weather information refers to these variables.
The only missing last observation time which I hope the developer will add to weatherman in the future.
There is another script I use which runs at midnight that tracks the min and max temps for the last x days. I'll post that later.
edit: Here's another slight update. It gets every piece of possible data from weathermanx and puts min/max temp data in a list. The last observation time is available and the script has been modified for that.
--[url=applescript://com.apple.scripteditor/?action=new&script=property%20WMcityname%20%3A%20%22Albuquerque,%20NM%22%0A%0Atell%20application%20%22WeatherManX%22%0A%09--get%20values%20from%20weatherman%0A%09try%0A%09%09set%20the%20updatetime%20to%20the%20Update%20Time%20of%20City%20WMcityname%0A%09%09set%20the%20condtime%20to%20the%20Conditions%20Time%20of%20City%20WMcityname%0A%09%09set%20the%20temp%20to%20the%20Current%20Temperature%20of%20City%20WMcityname%0A%09%09set%20the%20baro%20to%20the%20Current%20Pressure%20of%20City%20WMcityname%0A%09%09set%20the%20ptrend%20to%20the%20Pressure%20Trend%20of%20City%20WMcityname%0A%09%09set%20the%20wind_speed%20to%20the%20Wind%20Speed%20of%20City%20WMcityname%20as%20real%0A%09%09set%20the%20winggust%20to%20the%20Wind%20Gust%20of%20City%20WMcityname%0A%09%09set%20the%20wind_dir%20to%20the%20Wind%20Direction%20of%20City%20WMcityname%0A%09%09set%20the%20humid%20to%20the%20Humidity%20of%20City%20WMcityname%0A%09%09set%20the%20windchill%20to%20the%20Wind%20Chill%20of%20City%20WMcityname%0A%09%09set%20the%20heatindex%20to%20the%20Heat%20Index%20of%20City%20WMcityname%0A%09%09set%20the%20dew%20to%20the%20Dewpoint%20of%20City%20WMcityname%0A%09%09set%20the%20cond%20to%20the%20Conditions%20of%20City%20WMcityname%0A%09%09set%20the%20wether%20to%20the%20Weather%20of%20City%20WMcityname%0A%09%09set%20the%20vis%20to%20the%20(Visibility%20of%20City%20WMcityname)%20as%20integer%0A%09%09set%20the%20windlongdir%20to%20the%20Long%20Compass%20Wind%20Direction%20of%20City%20WMcityname%0A%09%09set%20the%20windshortdir%20to%20the%20Short%20Compass%20Wind%20Direction%20of%20City%20WMcityname%0A%09%09set%20the%20forecastlist%20to%20Forecast%20of%20City%20WMcityname%0A%09end%20try%0Aend%20tell%0A%0Atell%20application%20%22Indigo%22%0A%09--create%20variables%20if%20they%20don't%20exsit%0A%09if%20not%20(variable%20%22weather_last_update%22%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3A%22weather_last_update%22,%20value%3A%22%20%22%7D%0A%09if%20not%20(variable%20%22weather_temperature%22%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3A%22weather_temperature%22,%20value%3A%220%22%7D%0A%09if%20not%20(variable%20%22weather_barometer%22%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3A%22weather_barometer%22,%20value%3A%220%22%7D%0A%09if%20not%20(variable%20%22weather_pressure_trend%22%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3A%22weather_pressure_trend%22,%20value%3A%220%22%7D%0A%09if%20not%20(variable%20%22weather_wind_speed%22%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3A%22weather_wind_speed%22,%20value%3A%220%22%7D%0A%09if%20not%20(variable%20%22weather_wind_gust%22%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3A%22weather_wind_gust%22,%20value%3A%220%22%7D%0A%09if%20not%20(variable%20%22weather_wind_direction%22%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3A%22weather_wind_direction%22,%20value%3A%220%22%7D%0A%09if%20not%20(variable%20%22weather_humidity%22%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3A%22weather_humidity%22,%20value%3A%220%22%7D%0A%09if%20not%20(variable%20%22weather_wind_chill%22%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3A%22weather_wind_chill%22,%20value%3A%220%22%7D%0A%09if%20not%20(variable%20%22weather_heat_index%22%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3A%22weather_heat_index%22,%20value%3A%220%22%7D%0A%09if%20not%20(variable%20%22weather_dewpoint%22%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3A%22weather_dewpoint%22,%20value%3A%220%22%7D%0A%09if%20not%20(variable%20%22weather_current_conditions%22%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3A%22weather_current_conditions%22,%20value%3A%22%20%22%7D%0A%09if%20not%20(variable%20%22weather_visibility%22%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3A%22weather_visibility%22,%20value%3A%220%22%7D%0A%09if%20not%20(variable%20%22weather_long_compass_wind_direction%22%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3A%22weather_long_compass_wind_direction%22,%20value%3A%220%22%7D%0A%09if%20not%20(variable%20%22weather_short_compass_wind_direction%22%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3A%22weather_short_compass_wind_direction%22,%20value%3A%220%22%7D%0A%09if%20not%20(variable%20%22weather_last_rain%22%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3A%22weather_last_rain%22,%20value%3A%220%22%7D%0A%09if%20not%20(variable%20%22weather_max_temps%22%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3A%22weather_max_temps%22,%20value%3A%220,0,0,0,0,0%22%7D%0A%09if%20not%20(variable%20%22weather_min_temps%22%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3A%22weather_min_temps%22,%20value%3A%22800,800,800,800,800,800%22%7D%0A%09%0A%09--set%20the%20weather%20variables%0A%09set%20value%20of%20variable%20%22weather_last_update%22%20to%20condtime%0A%09set%20value%20of%20variable%20%22weather_temperature%22%20to%20temp%0A%09set%20value%20of%20variable%20%22weather_barometer%22%20to%20baro%0A%09set%20value%20of%20variable%20%22weather_pressure_trend%22%20to%20ptrend%0A%09set%20value%20of%20variable%20%22weather_wind_speed%22%20to%20wind_speed%0A%09set%20value%20of%20variable%20%22weather_wind_gust%22%20to%20winggust%0A%09set%20value%20of%20variable%20%22weather_wind_direction%22%20to%20wind_dir%0A%09set%20value%20of%20variable%20%22weather_humidity%22%20to%20humid%0A%09set%20value%20of%20variable%20%22weather_wind_chill%22%20to%20windchill%0A%09set%20value%20of%20variable%20%22weather_heat_index%22%20to%20heatindex%0A%09set%20value%20of%20variable%20%22weather_dewpoint%22%20to%20dew%0A%09if%20(wether%20%3D%20%22%22)%20then%0A%09%09set%20wmCond%20to%20cond%0A%09else%0A%09%09set%20wmCond%20to%20cond%20%26%20%22%20skies%20with%20%22%20%26%20wether%0A%09end%20if%0A%09set%20value%20of%20variable%20%22weather_current_conditions%22%20to%20wmCond%0A%09set%20value%20of%20variable%20%22weather_visibility%22%20to%20vis%0A%09set%20value%20of%20variable%20%22weather_long_compass_wind_direction%22%20to%20windlongdir%0A%09set%20value%20of%20variable%20%22weather_short_compass_wind_direction%22%20to%20windshortdir%0A%09--check%20to%20see%20if%20it's%20raining%20and%20log%20date%2Ftime%0A%09if%20((cond%20contains%20%22Rain%22)%20or%20(cond%20contains%20%22Mist%22)%20or%20(cond%20contains%20%22Drizzle%22)%20or%20(cond%20contains%20%22Snow%22)%20or%20(cond%20contains%20%22Sleet%22)%20or%20(cond%20contains%20%22Thunderstorm%22)%20or%20(wether%20contains%20%22Rain%22)%20or%20(wether%20contains%20%22Mist%22)%20or%20(wether%20contains%20%22Drizzle%22)%20or%20(wether%20contains%20%22Snow%22)%20or%20(wether%20contains%20%22Sleet%22)%20or%20(wether%20contains%20%22Thunderstorm%22))%20and%20(cond%20does%20not%20contain%20%22Clear%22)%20then%20set%20value%20of%20variable%20%22weather_last_rain%22%20to%20(current%20date)%20as%20string%0A%09--Set%20max%20and%20min%20temp%20of%20day%0A%09set%20VarVal%20to%20value%20of%20variable%20%22weather_max_temps%22%0A%09set%20OldDelims%20to%20AppleScript's%20text%20item%20delimiters%0A%09set%20AppleScript's%20text%20item%20delimiters%20to%20%22,%22%0A%09set%20theText%20to%20the%20text%20items%20of%20VarVal%0A%09set%20AppleScript's%20text%20item%20delimiters%20to%20OldDelims%0A%09if%20the%20temp%20%3E%20item%201%20of%20theText%20then%0A%09%09set%20item%201%20of%20theText%20to%20the%20temp%0A%09%09repeat%20with%20i%20from%201%20to%20(length%20of%20theText)%0A%09%09%09if%20i%20is%201%20then%0A%09%09%09%09set%20VarVal%20to%20item%20i%20of%20theText%0A%09%09%09else%0A%09%09%09%09set%20VarVal%20to%20VarVal%20%26%20%22,%22%20%26%20item%20i%20of%20theText%0A%09%09%09end%20if%0A%09%09end%20repeat%0A%09%09set%20value%20of%20variable%20%22weather_max_temps%22%20to%20VarVal%0A%09end%20if%0A%09set%20VarVal%20to%20value%20of%20variable%20%22weather_min_temps%22%0A%09set%20OldDelims%20to%20AppleScript's%20text%20item%20delimiters%0A%09set%20AppleScript's%20text%20item%20delimiters%20to%20%22,%22%0A%09set%20theText%20to%20the%20text%20items%20of%20VarVal%0A%09set%20AppleScript's%20text%20item%20delimiters%20to%20OldDelims%0A%09if%20the%20temp%20%3C%20item%201%20of%20theText%20then%0A%09%09set%20item%201%20of%20theText%20to%20the%20temp%0A%09%09repeat%20with%20i%20from%201%20to%20(length%20of%20theText)%0A%09%09%09if%20i%20is%201%20then%0A%09%09%09%09set%20VarVal%20to%20item%20i%20of%20theText%0A%09%09%09else%0A%09%09%09%09set%20VarVal%20to%20VarVal%20%26%20%22,%22%20%26%20item%20i%20of%20theText%0A%09%09%09end%20if%0A%09%09end%20repeat%0A%09%09set%20value%20of%20variable%20%22weather_min_temps%22%20to%20VarVal%0A%09end%20if%0A%09if%20temp%20%3E%20value%20of%20variable%20%22WMMaxTempToday%22%20then%0A%09%09set%20value%20of%20variable%20%22WMMaxTempToday%22%20to%20temp%0A%09end%20if%0A%09if%20temp%20%3C%20value%20of%20variable%20%22WMMinTempToday%22%20then%0A%09%09set%20value%20of%20variable%20%22WMMinTempToday%22%20to%20temp%0A%09end%20if%0A%09%0A%09--go%20through%20all%20variable%20and%20delete%20variables%20related%20to%20forecast%0A%09set%20i%20to%201%0A%09repeat%20(count%20of%20variables)%20times%0A%09%09if%20name%20of%20variable%20i%20contains%20%22weather_forecast%22%20then%0A%09%09%09delete%20variable%20i%0A%09%09else%0A%09%09%09set%20i%20to%20i%20+%201%0A%09%09end%20if%0A%09end%20repeat%0A%09--create%20variable%20for%20the%20forecast%0A%09repeat%20with%20dayforecast%20in%20forecastlist%0A%09%09set%20dayStr%20to%20item%201%20of%20dayforecast%0A%09%09set%20forecastStr%20to%20item%202%20of%20dayforecast%0A%09%09set%20varname%20to%20searchReplace(%22weather%20forecast%20%22%20%26%20dayStr,%20%22%20%22,%20%22_%22)%0A%09%09if%20not%20(variable%20varname%20exists)%20then%20make%20new%20variable%20with%20properties%20%7Bname%3Avarname,%20value%3AforecastStr%7D%0A%09end%20repeat%0Aend%20tell%0A%0Aon%20settemp(var,%20temp)%0A%09tell%20application%20%22Indigo%22%0A%09%09%0A%09end%20tell%0Aend%20settemp%0A%0Aon%20searchReplace(theText,%20SearchString,%20ReplaceString)%0A%09set%20OldDelims%20to%20AppleScript's%20text%20item%20delimiters%0A%09set%20AppleScript's%20text%20item%20delimiters%20to%20SearchString%0A%09set%20newText%20to%20text%20items%20of%20theText%0A%09set%20AppleScript's%20text%20item%20delimiters%20to%20ReplaceString%0A%09set%20newText%20to%20newText%20as%20text%0A%09set%20AppleScript's%20text%20item%20delimiters%20to%20OldDelims%0A%09return%20newText%0Aend%20searchReplace]Click here to open this script in a new Script Editor window[/url].
property WMcityname : "Albuquerque, NM"
tell application "WeatherManX"
--get values from weatherman
try
set the updatetime to the Update Time of City WMcityname
set the condtime to the Conditions Time of City WMcityname
set the temp to the Current Temperature of City WMcityname
set the baro to the Current Pressure of City WMcityname
set the ptrend to the Pressure Trend of City WMcityname
set the wind_speed to the Wind Speed of City WMcityname as real
set the winggust to the Wind Gust of City WMcityname
set the wind_dir to the Wind Direction of City WMcityname
set the humid to the Humidity of City WMcityname
set the windchill to the Wind Chill of City WMcityname
set the heatindex to the Heat Index of City WMcityname
set the dew to the Dewpoint of City WMcityname
set the cond to the Conditions of City WMcityname
set the wether to the Weather of City WMcityname
set the vis to the (Visibility of City WMcityname) as integer
set the windlongdir to the Long Compass Wind Direction of City WMcityname
set the windshortdir to the Short Compass Wind Direction of City WMcityname
set the forecastlist to Forecast of City WMcityname
end try
end tell
tell application "Indigo"
--create variables if they don't exsit
if not (variable "weather_last_update" exists) then make new variable with properties {name:"weather_last_update", value:" "}
if not (variable "weather_temperature" exists) then make new variable with properties {name:"weather_temperature", value:"0"}
if not (variable "weather_barometer" exists) then make new variable with properties {name:"weather_barometer", value:"0"}
if not (variable "weather_pressure_trend" exists) then make new variable with properties {name:"weather_pressure_trend", value:"0"}
if not (variable "weather_wind_speed" exists) then make new variable with properties {name:"weather_wind_speed", value:"0"}
if not (variable "weather_wind_gust" exists) then make new variable with properties {name:"weather_wind_gust", value:"0"}
if not (variable "weather_wind_direction" exists) then make new variable with properties {name:"weather_wind_direction", value:"0"}
if not (variable "weather_humidity" exists) then make new variable with properties {name:"weather_humidity", value:"0"}
if not (variable "weather_wind_chill" exists) then make new variable with properties {name:"weather_wind_chill", value:"0"}
if not (variable "weather_heat_index" exists) then make new variable with properties {name:"weather_heat_index", value:"0"}
if not (variable "weather_dewpoint" exists) then make new variable with properties {name:"weather_dewpoint", value:"0"}
if not (variable "weather_current_conditions" exists) then make new variable with properties {name:"weather_current_conditions", value:" "}
if not (variable "weather_visibility" exists) then make new variable with properties {name:"weather_visibility", value:"0"}
if not (variable "weather_long_compass_wind_direction" exists) then make new variable with properties {name:"weather_long_compass_wind_direction", value:"0"}
if not (variable "weather_short_compass_wind_direction" exists) then make new variable with properties {name:"weather_short_compass_wind_direction", value:"0"}
if not (variable "weather_last_rain" exists) then make new variable with properties {name:"weather_last_rain", value:"0"}
if not (variable "weather_max_temps" exists) then make new variable with properties {name:"weather_max_temps", value:"0,0,0,0,0,0"}
if not (variable "weather_min_temps" exists) then make new variable with properties {name:"weather_min_temps", value:"800,800,800,800,800,800"}
--set the weather variables
set value of variable "weather_last_update" to condtime
set value of variable "weather_temperature" to temp
set value of variable "weather_barometer" to baro
set value of variable "weather_pressure_trend" to ptrend
set value of variable "weather_wind_speed" to wind_speed
set value of variable "weather_wind_gust" to winggust
set value of variable "weather_wind_direction" to wind_dir
set value of variable "weather_humidity" to humid
set value of variable "weather_wind_chill" to windchill
set value of variable "weather_heat_index" to heatindex
set value of variable "weather_dewpoint" to dew
if (wether = "") then
set wmCond to cond
else
set wmCond to cond & " skies with " & wether
end if
set value of variable "weather_current_conditions" to wmCond
set value of variable "weather_visibility" to vis
set value of variable "weather_long_compass_wind_direction" to windlongdir
set value of variable "weather_short_compass_wind_direction" to windshortdir
--check to see if it's raining and log date/time
if ((cond contains "Rain") or (cond contains "Mist") or (cond contains "Drizzle") or (cond contains "Snow") or (cond contains "Sleet") or (cond contains "Thunderstorm") or (wether contains "Rain") or (wether contains "Mist") or (wether contains "Drizzle") or (wether contains "Snow") or (wether contains "Sleet") or (wether contains "Thunderstorm")) and (cond does not contain "Clear") then set value of variable "weather_last_rain" to (current date) as string
--Set max and min temp of day
set VarVal to value of variable "weather_max_temps"
set OldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to ","
set theText to the text items of VarVal
set AppleScript's text item delimiters to OldDelims
if the temp > item 1 of theText then
set item 1 of theText to the temp
repeat with i from 1 to (length of theText)
if i is 1 then
set VarVal to item i of theText
else
set VarVal to VarVal & "," & item i of theText
end if
end repeat
set value of variable "weather_max_temps" to VarVal
end if
set VarVal to value of variable "weather_min_temps"
set OldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to ","
set theText to the text items of VarVal
set AppleScript's text item delimiters to OldDelims
if the temp < item 1 of theText then
set item 1 of theText to the temp
repeat with i from 1 to (length of theText)
if i is 1 then
set VarVal to item i of theText
else
set VarVal to VarVal & "," & item i of theText
end if
end repeat
set value of variable "weather_min_temps" to VarVal
end if
if temp > value of variable "WMMaxTempToday" then
set value of variable "WMMaxTempToday" to temp
end if
if temp < value of variable "WMMinTempToday" then
set value of variable "WMMinTempToday" to temp
end if
--go through all variable and delete variables related to forecast
set i to 1
repeat (count of variables) times
if name of variable i contains "weather_forecast" then
delete variable i
else
set i to i + 1
end if
end repeat
--create variable for the forecast
repeat with dayforecast in forecastlist
set dayStr to item 1 of dayforecast
set forecastStr to item 2 of dayforecast
set varname to searchReplace("weather forecast " & dayStr, " ", "_")
if not (variable varname exists) then make new variable with properties {name:varname, value:forecastStr}
end repeat
end tell
on settemp(var, temp)
tell application "Indigo"
end tell
end settemp
on searchReplace(theText, SearchString, ReplaceString)
set OldDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to SearchString
set newText to text items of theText
set AppleScript's text item delimiters to ReplaceString
set newText to newText as text
set AppleScript's text item delimiters to OldDelims
return newText
end searchReplace
-------------------------
[This script was automatically tagged for color coded syntax by
Script to Markup Code]