[Windows Mobile Apps and Games] brock1909:
ok,well i think i almost have this thing figured out.

BUT i cannot get the % of rain chance to work, it always shows 20 and the % sign will not show up.

and there are times, like now, that i have no wallpaper, and some of the onscreen data is missing. is that a connection issue?

Here is my current script.

# Get the path to the files needed

wpPath = RegRead( "HKCU", "\Software\MarsWare\WeatherPanel", "ProgramPath" )
script = SystemPath("ScriptPath") & "\" & SystemPath("ScriptName") & SystemPath("ScriptExt")
logfile = SystemPath("ScriptPath") & "\" & "Current Weather Log.TXT"

curweather = RegRead("HKCU", "\Software\A_C\S2U2\", "UserWeather")
weather = ""

##
# how often to try and get the weather
delayminutes = 15

GetTime(hour,min,sec,day,month,year)
##
today = ( day & "/" & month & "/" & year )
##
Runtime = "Updated: " & day & "/" & month & "/" & year & " - " & hour & ":" & min & "^NL^"

##
#message( runtime , "" )
##

#WriteFile (logfile, %runtime% , TRUE)

# set up for next notification
utime = TimeStamp() + (delayminutes*60)

# kill existing notifications for script
RemoveNotifications(script)
# set notification for for next run
RunAt( utime, script)

hourlyfile= wpPath\"data\USMI0322-hourly"
currentfile= wpPath\"data\USMI0322-current"
##
forecastfile = wpPath\"data\USMI0322-forecast"

#Find High / Low temps & forecast icon
forecastdata = ReadFile(forecastfile)

for line = 1 to 170
segment[line] = Part( forecastdata, "^NL^", line )
Next

for count=0 to 9

If (count=0)
ind=1

Else

ind=((count*17)+1)
EndIf

day_no=((segment[ind]-25569)*86400)
daystring = Format( day_no, 6)

Day_no=FormatTime( "d/m/Y", daystring)
if (day_no eq today)
forecast_code_day = segment[ ind + 5 ]
forecast_code_night = segment[ ind + 11 ]
rain_AM = segment[ ind + 9 ]
rain_PM = segment[ ind + 15 ]
maxtempf = segment[ ind + 1 ]
mintempf = segment[ ind + 2 ]
maxtemp=((maxtempf-32)*5)/9
mintemp=((mintempf-32)*5)/9
#
If ( maxtempf = -9999)
maxtempf = "--"
maxtemp = "--"
EndIf
#
If ( mintempf = -9999)
mintempf = "--"
mintemp = "--"
EndIf
#
If ( hour > 6 AND hour < 20 )
forecast_code = forecast_code_day
Else
forecast_code = forecast_code_night
EndIf
#
If ( hour < 12 )
chance_rain = rain_AM
Else
chance_rain = rain_PM
EndIf

#Message (forecast_code , hour )
# message( day_no , count)
# message( maxtemp, mintemp )

EndIf

next

##
#Find current location

find_location = ReadFile( currentfile )
location_length = find( find_location , "," )
location_name = substr( find_location , 1 , ( location_length - 1 ) )

endofcurrenthour = FormatTime( "d/m/Y H", (timestamp() + 3600))

##Check last update time

currentdata = ReadFile( currentfile )
Updatetime = ((SubStr( currentdata, 27, 12 )-25569)*86400)

updatetimestring = Format( updatetime, 0)

onehourago = ( timestamp() - 3600 )
If ( onehourago Lt updatetimestring )

filedata = ReadFile( currentfile )

for line = 1 to 17
segment[line] = Part( filedata, "^NL^", line )
Next
feeltempf = segment[ 4 ]
current_code = segment[ 7 ]
summary = segment[ 8 ]

maxtemp=((tempf-32)*5)/9
feeltemp=((feeltempf-32)*5)/9

display1 = " Feels: "& feeltemp&"°"
display2 = " " & summary & " -Feels: "& feeltemp & "°"
display3 = " " & location_name & ": " & summary & " -Feels:" & feeltemp & "°"
display4 = " " & location_name & ": " & summary & " -High:" & maxtemp & "°" & " -Feels:"& feeltemp & "°"
display5 = " " & location_name & ": " & "High:" & maxtemp & "°" & " -Feels:" & feeltemp & "°"
display6 = " " & summary & " -High:" & maxtemp & "°" & " -Feels:"& feeltemp & "°"
display7 = " High:" & maxtemp & "°" & " -Feels:"& feeltemp & "°"
display8 = " " & summary & " -High:" & maxtemp & "°" & " -rain: " & chance_rain & "%"

Else

filedata = ReadFile( hourlyfile )

for line = 1 to 239
segment[line] = Part( filedata, "^NL^", line )
Next

for count=0 to 22

If (count=0)
ind=1

Else

ind=((count*10)+1)
EndIf

convertdate=((segment[ind]-25569)*86400)
datestring = Format( convertdate, 6)

Day=FormatTime( "d/m/Y", datestring)
Hour=FormatTime( "H", datestring)
Min=FormatTime( "i", datestring)

if (Min <> 00)
Min = "00"
Hour = (Hour + 1)
If (Length(Hour)<>2
Hour = ("0" & Hour)
EndIf
EndIf

periodtime =(Day & " " & Hour )

If (endofcurrenthour eq periodtime)

feeltempf = segment[ind + 2 ]
current_code = segment[ind + 3 ]
summary = segment[ind + 4 ]

maxtemp=((tempf-32)*5)/9
feeltemp=((feeltempf-32)*5)/9

display1 = " Feels: "& feeltemp&"°"
display2 = " " & summary & " -Feels: "& feeltemp & "°"
display3 = " " & location_name & ": " & summary & " -Feels:" & feeltemp & "°"
display4 = " " & location_name & ": " & summary & " -High:" & maxtemp & "°" & " -Feels:"& feeltemp & "°"
display5 = " " & location_name & ": " & "High:" & maxtemp & "°" & " -Feels:" & feeltemp & "°"
display6 = " " & summary & " -High:" & maxtemp & "°" & " -Feels:"& feeltemp & "°"
display7 = " High:" & maxtemp & "°" & " -Feels:"& feeltemp & "°"
display8 = " " & summary & " High:" & maxtemp & "°" & " Feels:"& feeltemp & "°" & " rain: " & chance_rain & "%"

EndIf

next

EndIf

#Choose what to display:
#display1 = " Feels: 21°"
#display2 = " Sunny - Feels: 21°"
#display3 = " London: Sunny - Feels: 21°"
#display4 = " London: Sunny - High: 26° - Feels: 21°"
#display5 = " London: - High: 26° - Feels: 21°"
#display6 = " Sunny - High: 26° - Feels: 21°"
#display7 = " High: 26° - Feels: 21°"
#
#change to display1 through 7 as required

weather="C|" & forecast_code & "|" & summary & " High:" & maxtempf & "°" & " Feels:"& feeltempf & "°" & " rain: " & chance_rain & "%"

#if (curweather ne weather)
RegWriteString("HKCU", "\Software\A_C\S2U2\", "UserWeather", weather)
wallpaper="\storage card\weather_Wallpaper\" & current_code & ".jpg"
RegWriteString("HKCU", "\Software\A_C\S2U2\", "Wallpaper", wallpaper)
Run("\Program Files\S2U2\iLock2.exe","-refresh")

Run("\Program Files\S2U2\iLock2.exe","-refresh")
#endif