I've written a few lines to parse out the text lines for the iphone. Just add the new "day1Period1Line1" etc variables and put this as a second action: embedded applescript in your time date action. Modify the control page to see the full forecast. If someone knows how to make it recognize words instead of splitting them that would be great. Modify the character numbers to fit your screen. I'm using Arial 14.
This has been updated to account for up to 6 lines of text.
- Code: Select all
using terms from application "IndigoServer"
tell application "IndigoServer"
set day1Period1Forecast to value of variable "Wunderground_Day1Period1TextForecast" as string
set day1Period2Forecast to value of variable "Wunderground_Day1Period2TextForecast" as string
if length of day1Period1Forecast is less than 91 then
set value of variable "day1Period1Line1" to (characters 1 through 45 of day1Period1Forecast) as string
set value of variable "day1Period1Line2" to (characters 46 through -1 of day1Period1Forecast) as string
set value of variable "day1Period1Line3" to ""
set value of variable "day1Period1Line4" to ""
set value of variable "day1Period1Line5" to ""
set value of variable "day1Period1Line6" to ""
end if
if ((length of day1Period1Forecast is greater than 90) and (length of day1Period1Forecast is less than 136)) then
set value of variable "day1Period1Line1" to (characters 1 through 45 of day1Period1Forecast) as string
set value of variable "day1Period1Line2" to (characters 46 through 90 of day1Period1Forecast) as string
set value of variable "day1Period1Line3" to (characters 91 through -1 of day1Period1Forecast) as string
set value of variable "day1Period1Line4" to ""
set value of variable "day1Period1Line5" to ""
set value of variable "day1Period1Line6" to ""
end if
if ((length of day1Period1Forecast is greater than 135) and (length of day1Period1Forecast is less than 181)) then
set value of variable "day1Period1Line1" to (characters 1 through 45 of day1Period1Forecast) as string
set value of variable "day1Period1Line2" to (characters 46 through 90 of day1Period1Forecast) as string
set value of variable "day1Period1Line3" to (characters 91 through 135 of day1Period1Forecast) as string
set value of variable "day1Period1Line4" to (characters 136 through -1 of day1Period1Forecast) as string
set value of variable "day1Period1Line5" to ""
set value of variable "day1Period1Line6" to ""
end if
if ((length of day1Period1Forecast is greater than 180) and (length of day1Period1Forecast is less than 226)) then
set value of variable "day1Period1Line1" to (characters 1 through 45 of day1Period1Forecast) as string
set value of variable "day1Period1Line2" to (characters 46 through 90 of day1Period1Forecast) as string
set value of variable "day1Period1Line3" to (characters 91 through 135 of day1Period1Forecast) as string
set value of variable "day1Period1Line4" to (characters 136 through 180 of day1Period1Forecast) as string
set value of variable "day1Period1Line5" to (characters 181 through -1 of day1Period1Forecast) as string
set value of variable "day1Period1Line6" to ""
end if
if length of day1Period1Forecast is greater than 225 then
set value of variable "day1Period1Line1" to (characters 1 through 45 of day1Period1Forecast) as string
set value of variable "day1Period1Line2" to (characters 46 through 90 of day1Period1Forecast) as string
set value of variable "day1Period1Line3" to (characters 91 through 135 of day1Period1Forecast) as string
set value of variable "day1Period1Line4" to (characters 136 through 180 of day1Period1Forecast) as string
set value of variable "day1Period1Line5" to (characters 181 through 225 of day1Period1Forecast) as string
set value of variable "day1Period1Line6" to (characters 226 through -1 of day1Period1Forecast) as string
end if
--These are for period 2
if length of day1Period2Forecast is less than 91 then
set value of variable "day1Period2Line1" to (characters 1 through 45 of day1Period2Forecast) as string
set value of variable "day1Period2Line2" to (characters 46 through -1 of day1Period2Forecast) as string
set value of variable "day1Period2Line3" to ""
set value of variable "day1Period2Line4" to ""
set value of variable "day1Period2Line5" to ""
set value of variable "day1Period2Line6" to ""
end if
if ((length of day1Period2Forecast is greater than 90) and (length of day1Period2Forecast is less than 136)) then
set value of variable "day1Period2Line1" to (characters 1 through 45 of day1Period2Forecast) as string
set value of variable "day1Period2Line2" to (characters 46 through 90 of day1Period2Forecast) as string
set value of variable "day1Period2Line3" to (characters 91 through -1 of day1Period2Forecast) as string
set value of variable "day1Period2Line4" to ""
set value of variable "day1Period2Line5" to ""
set value of variable "day1Period2Line6" to ""
end if
if ((length of day1Period2Forecast is greater than 135) and (length of day1Period2Forecast is less than 181)) then
set value of variable "day1Period2Line1" to (characters 1 through 45 of day1Period2Forecast) as string
set value of variable "day1Period2Line2" to (characters 46 through 90 of day1Period2Forecast) as string
set value of variable "day1Period2Line3" to (characters 91 through 135 of day1Period2Forecast) as string
set value of variable "day1Period2Line4" to (characters 136 through -1 of day1Period2Forecast) as string
set value of variable "day1Period2Line5" to ""
set value of variable "day1Period2Line6" to ""
end if
if ((length of day1Period2Forecast is greater than 180) and (length of day1Period2Forecast is less than 226)) then
set value of variable "day1Period2Line1" to (characters 1 through 45 of day1Period2Forecast) as string
set value of variable "day1Period2Line2" to (characters 46 through 90 of day1Period2Forecast) as string
set value of variable "day1Period2Line3" to (characters 91 through 135 of day1Period2Forecast) as string
set value of variable "day1Period2Line4" to (characters 136 through 180 of day1Period2Forecast) as string
set value of variable "day1Period2Line5" to (characters 181 through -1 of day1Period2Forecast) as string
set value of variable "day1Period2Line6" to ""
end if
if length of day1Period2Forecast is greater than 225 then
set value of variable "day1Period2Line1" to (characters 1 through 45 of day1Period2Forecast) as string
set value of variable "day1Period2Line2" to (characters 46 through 90 of day1Period2Forecast) as string
set value of variable "day1Period2Line3" to (characters 91 through 135 of day1Period2Forecast) as string
set value of variable "day1Period2Line4" to (characters 136 through 180 of day1Period2Forecast) as string
set value of variable "day1Period2Line5" to (characters 181 through 255 of day1Period2Forecast) as string
set value of variable "day1Period2Line6" to (characters 226 through -1 of day1Period2Forecast) as string
end if
end tell
end using terms from
[edit Feb 27, 2011] Corrected a couple of numbers in the less than/greater than statements.