Option Explicit Private Const ICON_INDEX=3 Private Const BROADCAST_CANVAS_INDEX=2 Private Const FORECAST_CANVAS_INDEX=3 Private Const WEATHER_TEXT_INDEX=2 Private Const TEMP_TEXT_INDEX=4 Private Const HUM_TEXT_INDEX=8 Private Const BAROM_TEXT_INDEX=9 Private Const FORECAST_INDEX=60 Private Const FORREADING=1 Private Const FORWRITING=2 Private Const FORAPPENDING=8 Dim DayBrief(20) Dim DayHigh(20) Dim DayLow(20) Dim DayPercent(20) Dim DayIconNumber(20) Dim DayDayNight(20) '0=day, 1=night Dim Sent(20,100) Dim SentNumber(20) Dim NumberOfDays Dim DayLine(20) Dim DayText(20) Dim DayFull(20) NumberOfDays=-1 Public Sub Interval() If True Then 'Load Forecast Dim FSO Set FSO=CreateObject("Scripting.FileSystemObject") Dim ForecastTS Dim Forecast Set ForecastTS=FSO.OpenTextFile("C:\vws1021\root\zone17.txt",FORREADING,True) Forecast=ForecastTS.ReadAll Set ForecastTS=Nothing Set FSO=Nothing 'Parse forecast Dim ForecastLength Dim ForecastLines(100) ForecastLength=0 If Forecast<>"" Then Dim FA FA=Split(Forecast,vbLf) Dim FAL Dim OnForecast OnForecast=False Dim FL NumberOfDays=-1 For FAL=LBound(FA) to UBound(FA) FL=Trim(FA(FAL)) While Instr(FL,vbCr) FL=Left(FL,Instr(FL,vbCr)-1)+Mid(FL,Instr(FL,vbCr)+1) Wend If FL="" Then If OnForecast=True Then OnForecast=False Exit For Else End if ElseIf Left(FL,1)="." and Left(FL,2)<>".." Then OnForecast=True NumberOfDays=NumberOfDays+1 FL=Mid(FL,2) DayLine(NumberOfDays)=FL If Instr(FL,"...")<>0 Then DayFull(NumberOfDays)=LCase(Mid(FL,Instr(FL,"...")+3)) DayText(NumberOfDays)=CapitalizeFirst(Left(FL,Instr(FL,"...")-1)) FL=Left(FL,Instr(FL,"...")-1)+": "+Mid(FL,Instr(FL,"...")+3) End If If ForecastLength<>0 Then ForecastLines(ForecastLength)=" " ForecastLength=ForecastLength+1 End If ForecastLines(ForecastLength)=FL ForecastLength=ForecastLength+1 Else If OnForecast=True Then DayFull(NumberOfDays)=DayFull(NumberOfDays)+" "+LCase(Trim(FL)) DayLine(NumberOfDays)=DayLine(NumberOfDays)+" "+FL ForecastLines(ForecastLength)=" "+FL ForecastLength=ForecastLength+1 End If End if If ForecastLength=101 then OnForecast=False:Exit For Next End If End If If True Then 'Parse forecast (work in progress) 'NumberOfDays - 0 based 'Fields: 'Day Text 'Day Full Forecast Text 'Day Brief Forecast Text 'Day High 'Day Low 'Day Precip Percentage 'Day IconNumber 'Day Day/Night 0=day, 1=night Dim i For i=0 to NumberOfDays DayLine(i)=RemoveExtraSpaces(DayLine(i)) DayFull(i)=RemoveExtraSpaces(DayFull(i)) DayText(i)=RemoveExtraSpaces(DayText(i)) Next 'Break into sentences For i=0 to NumberOfDays If Instr(LCase(DayText(i)),"night")=0 Then DayDayNight(i)=0 Else DayDayNight(i)=1 If Right(DayFull(i),1)<>"." Then DayFull(i)=DayFull(i)+"." SentNumber(i)=0 Sent(i,0)="" Dim c For c=1 to Len(DayFull(i)) If Mid(DayFull(i),c,1)="." Then Sent(i,SentNumber(i))=Trim(Sent(i,SentNumber(i))) If Sent(i,SentNumber(i))<>"" Then SentNumber(i)=SentNumber(i)+1 Sent(i,SentNumber(i))="" End If Else Sent(i,SentNumber(i))=Sent(i,SentNumber(i))+Mid(DayFull(i),c,1) End If Next Sent(i,SentNumber(i))=Trim(Sent(i,SentNumber(i))) If Sent(i,SentNumber(i))="" Then SentNumber(i)=SentNumber(i)-1 Dim s DayIconNumber(i)=0 DayPercent(i)=0 DayHigh(i)=-1000 DayLow(i)=-1000 DayBrief(i)="Clear" s=0 If Instr(Sent(i,s),"clouds")<>0 Then DayIconNumber(i)=2 DayBrief(i)="Clouds" If Instr(Sent(i,s),"few")<>0 Then DayIconNumber(i)=1 DayBrief(i)="Few Clouds" End If End If If Instr(Sent(i,s),"cloudy")<>0 Then DayIconNumber(i)=4 DayBrief(i)="Cloudy" If Instr(Sent(i,s),"partly")<>0 Then DayIconNumber(i)=2 DayBrief(i)="Partly Cloudy" End If If Instr(Sent(i,s),"mostly")<>0 Then DayIconNumber(i)=3 DayBrief(i)="Mostly Cloudy" End If End If If Instr(Sent(i,s),"clear")<>0 and Instr(Sent(i,s),"clearing")=0 Then DayIconNumber(i)=0 DayBrief(i)="Clear" If Instr(Sent(i,s),"mostly")<>0 Then DayIconNumber(i)=1 DayBrief(i)="Mostly Clear" End If End If If Instr(Sent(i,s),"rain")<>0 Then DayIconNumber(i)=6 DayBrief(i)="Rain" DayPercent(i)=100 If Instr(Sent(i,s),"isolated")<>0 Then DayPercent(i)=60 End If If Instr(Sent(i,s),"scattered")<>0 Then DayPercent(i)=50 End If If Instr(Sent(i,s),"chance")<>0 Then DayPercent(i)=20 End If If Instr(Sent(i,s),"slight")<>0 Then DayPercent(i)=10 End If If Instr(Sent(i,s),"percent")<>0 Then DayPercent(i)=GetNumber(Sent(i,s),Instr(sent(i,s),"percent")-4) End If End If If Instr(Sent(i,s),"showers")<>0 Then DayIconNumber(i)=8 DayBrief(i)="Showers" DayPercent(i)=100 If Instr(Sent(i,s),"isolated")<>0 Then DayPercent(i)=60 End If If Instr(Sent(i,s),"scattered")<>0 Then DayPercent(i)=50 End If If Instr(Sent(i,s),"chance")<>0 Then DayPercent(i)=20 End If If Instr(Sent(i,s),"slight")<>0 Then DayPercent(i)=10 End If If Instr(Sent(i,s),"percent")<>0 Then DayPercent(i)=GetNumber(Sent(i,s),Instr(sent(i,s),"percent")-4) End If End If If Instr(Sent(i,s),"thunderstorm")<>0 Then DayIconNumber(i)=21 DayBrief(i)="Thunderstorms" DayPercent(i)=100 If Instr(Sent(i,s),"isolated")<>0 Then DayPercent(i)=60 End If If Instr(Sent(i,s),"scattered")<>0 Then DayPercent(i)=50 End If If Instr(Sent(i,s),"chance")<>0 Then DayPercent(i)=20 End If If Instr(Sent(i,s),"slight")<>0 Then DayPercent(i)=10 End If If Instr(Sent(i,s),"percent")<>0 Then DayPercent(i)=GetNumber(Sent(i,s),Instr(sent(i,s),"percent")-4) End If End If If Instr(Sent(i,s),"hazy")<>0 or Instr(Sent(i,s),"haze")<>0 Then DayIconNumber(i)=14 DayBrief(i)="Haze" End If If Instr(Sent(i,s),"snow")<>0 Then DayIconNumber(i)=18 DayBrief(i)="Snow" DayPercent(i)=100 If Instr(Sent(i,s),"chance")<>0 Then DayPercent(i)=20 End If If Instr(Sent(i,s),"slight")<>0 Then DayPercent(i)=10 End If If Instr(Sent(i,s),"percent")<>0 Then DayPercent(i)=GetNumber(Sent(i,s),Instr(sent(i,s),"percent")-4) End If End If If Instr(Sent(i,s),"flurries")<>0 Then DayIconNumber(i)=17 DayBrief(i)="Flurries" DayPercent(i)=100 If Instr(Sent(i,s),"chance")<>0 Then DayPercent(i)=20 End If If Instr(Sent(i,s),"slight")<>0 Then DayPercent(i)=10 End If If Instr(Sent(i,s),"percent")<>0 Then DayPercent(i)=GetNumber(Sent(i,s),Instr(sent(i,s),"percent")-4) End If End If If Instr(Sent(i,s),"hot")<>0 Then DayIconNumber(i)=0 DayBrief(i)="Hot" End If For s=1 to SentNumber(i) If Instr(Sent(i,s),"showers")<>0 Then DayIconNumber(i)=8 DayPercent(i)=100 If Instr(Sent(i,s),"isolated")<>0 Then DayPercent(i)=60 End If If Instr(Sent(i,s),"scattered")<>0 Then DayPercent(i)=50 End If If Instr(Sent(i,s),"chance")<>0 Then DayPercent(i)=20 End If If Instr(Sent(i,s),"slight")<>0 Then DayPercent(i)=10 End If If Instr(Sent(i,s),"percent")<>0 Then DayPercent(i)=GetNumber(Sent(i,s),Instr(sent(i,s),"percent")-4) End If End If If Instr(Sent(i,s),"rain")<>0 Then DayIconNumber(i)=6 DayPercent(i)=100 If Instr(Sent(i,s),"isolated")<>0 Then DayPercent(i)=60 End If If Instr(Sent(i,s),"scattered")<>0 Then DayPercent(i)=50 End If If Instr(Sent(i,s),"chance")<>0 Then DayPercent(i)=20 End If If Instr(Sent(i,s),"slight")<>0 Then DayPercent(i)=10 End If If Instr(Sent(i,s),"percent")<>0 Then DayPercent(i)=GetNumber(Sent(i,s),Instr(sent(i,s),"percent")-4) End If End If If Instr(Sent(i,s),"thunderstorm")<>0 Then DayIconNumber(i)=21 DayPercent(i)=100 If Instr(Sent(i,s),"isolated")<>0 Then DayPercent(i)=60 End If If Instr(Sent(i,s),"scattered")<>0 Then DayPercent(i)=50 End If If Instr(Sent(i,s),"chance")<>0 Then DayPercent(i)=20 End If If Instr(Sent(i,s),"slight")<>0 Then DayPercent(i)=10 End If If Instr(Sent(i,s),"percent")<>0 Then DayPercent(i)=GetNumber(Sent(i,s),Instr(sent(i,s),"percent")-4) End If End If If Instr(Sent(i,s),"highs")<>0 and Instr(Sent(i,s),"lows")<>0 Then Dim h,l h=Instr(Sent(i,s),"highs") l=Instr(Sent(i,s),"lows") If l0 Then DayHigh(i)=GetTempRange(Sent(i,s)) ElseIf Instr(left(Sent(i,s),8),"lows")<>0 Then DayLow(i)=GetTempRange(Sent(i,s)) End If Next Next End If If True Then 'Update Canvas 2 With Portfolio.Canvas(BROADCAST_CANVAS_INDEX) Dim line For line=FORECAST_INDEX to 99 .Text(CLng(line)).Text="" Next If ForecastLength>0 Then ForecastLength=ForecastLength-1 If ForecastLength>26 then ForecastLength=26 For line=0 to ForecastLength .Text(CLng(line+FORECAST_INDEX)).Text=ForecastLines(line) Next End If End With End if If True Then 'Update Canvas 3 With Portfolio.Canvas(FORECAST_CANVAS_INDEX) For i=0 to 6 If Instr(DayText(i)," ")=0 Then .Text(CLng(i+40)).Text=DayText(i) .Text(CLng(i+50)).Text="" .Text(CLng(i+40)).Y=37 Else .Text(CLng(i+40)).Text=Left(DayText(i),Instr(DayText(i)," ")-1) .Text(CLng(i+50)).Text=Mid(DayText(i),Instr(DayText(i)," ")+1) .Text(CLng(i+40)).Y=30 End If If DayPercent(i)=0 Then .Text(CLng(i+30)).Text="" Else .Text(CLng(i+30)).Text=CStr(DayPercent(i))+"%" End If If DayHigh(i)=-1000 or DayLow(i)=-1000 Then .Text(CLng(i+10)).Y=140 .Text(CLng(i+20)).Y=140 Else .Text(CLng(i+10)).Y=130 .Text(CLng(i+20)).Y=150 End If If DayHigh(i)=-1000 Then .Text(CLng(i+10)).Text="" Else .Text(CLng(i+10)).Text=CStr(DayHigh(i))+"°F" End If If DayLow(i)=-1000 Then .Text(CLng(i+20)).Text="" Else .Text(CLng(i+20)).Text=CStr(DayLow(i))+"°F" End If If DayDayNight(i)=0 Then .Graphic(CLng(i+2)).SourceFileName="c:\Demos\Icons\icon"+vbFormat(DayIconNumber(i),"00")+"d.jpg" Else .Graphic(CLng(i+2)).SourceFileName="c:\Demos\Icons\icon"+vbFormat(DayIconNumber(i),"00")+"n.jpg" End if Next End With End If End Sub Public Sub NewCSVData() Call FolsomWeatherUpdate() Dim c c=Portfolio.VWS.LastData(19) Dim clock clock=CDbl(Now) clock=clock-Int(clock) With Portfolio.Canvas(BROADCAST_CANVAS_INDEX) .Text(TEMP_TEXT_INDEX).Text=vbFormat(Portfolio.VWS.LastData(14),"0") .Text(HUM_TEXT_INDEX).Text=vbFormat(Portfolio.VWS.LastData(12),"0")+"%" .Text(BAROM_TEXT_INDEX).Text=vbFormat(Portfolio.VWS.LastData(55),"00.00")+Chr(34) Select Case c Case 0 .Text(WEATHER_TEXT_INDEX).Text="Clear" Case 1 .Text(WEATHER_TEXT_INDEX).Text="Few Clouds" Case 2 .Text(WEATHER_TEXT_INDEX).Text="Scattered Clouds" Case 3 .Text(WEATHER_TEXT_INDEX).Text="Mostly Cloudy" Case 4 .Text(WEATHER_TEXT_INDEX).Text="Overcast" Case 5 .Text(WEATHER_TEXT_INDEX).Text="Drizzle" Case 6 .Text(WEATHER_TEXT_INDEX).Text="Rain" Case 7 .Text(WEATHER_TEXT_INDEX).Text="Frozen Rain" Case 8 .Text(WEATHER_TEXT_INDEX).Text="Showers" Case 9 .Text(WEATHER_TEXT_INDEX).Text="Mist" Case 10 .Text(WEATHER_TEXT_INDEX).Text="Tornado" Case 11 .Text(WEATHER_TEXT_INDEX).Text="Fog" Case 12 .Text(WEATHER_TEXT_INDEX).Text="Smoke" Case 13 .Text(WEATHER_TEXT_INDEX).Text="Hail" Case 14 .Text(WEATHER_TEXT_INDEX).Text="Haze" Case 15 .Text(WEATHER_TEXT_INDEX).Text="Ice Crystals" Case 16 .Text(WEATHER_TEXT_INDEX).Text="Sand" Case 17 .Text(WEATHER_TEXT_INDEX).Text="Snow Grains" Case 18 .Text(WEATHER_TEXT_INDEX).Text="Snow" Case 19 .Text(WEATHER_TEXT_INDEX).Text="Snow Showers" Case 20 .Text(WEATHER_TEXT_INDEX).Text="Lighning" Case 21 .Text(WEATHER_TEXT_INDEX).Text="Thunderstorms" Case Else End Select If clock>=Sunrise and clock<=Sunset then 'Daytime icons .Graphic(ICON_INDEX).SourceFileName="c:\Demos\Icons\icon"+vbFormat(c,"00")+"d.jpg" Else 'Nighttime icons .Graphic(ICON_INDEX).SourceFileName="c:\Demos\Icons\icon"+vbFormat(c,"00")+"n.jpg" End If End With End Sub Private Function RemoveExtraSpaces(Text) Dim myReturn myReturn=Trim(Text) While Instr(myReturn," ")<>0 myReturn=Left(myReturn,Instr(myReturn," "))+Mid(myReturn,Instr(myReturn," ")+2) Wend RemoveExtraSpaces=myReturn End Function Private Function CapitalizeFirst(Text) Dim myReturn myReturn=Trim(Text) Dim i Dim myReturn2 myReturn2="" For i=1 to Len(myReturn) If i=1 Then myReturn2=UCase(Mid(myReturn,i,1)) Else If Mid(myReturn,i-1,1)=" " Then myReturn2=myReturn2+UCase(Mid(myReturn,i,1)) Else myReturn2=myReturn2+LCase(Mid(myReturn,i,1)) End If End If Next CapitalizeFirst=myReturn2 End Function Private Function GetNumber(Strng,Pos) If Pos<1 Then Pos=1 Dim procstr Dim i procstr=Mid(Strng,Pos) Dim newstr newstr="" For i=1 to Len(procstr) If Mid(procstr,i,1)>="0" and Mid(procstr,i,1)<="9" Then newstr=newstr+Mid(procstr,i,1) End if Next If Trim(newstr)="" Then GetNumber=-1000 Else GetNumber=CLng(newstr) End If End Function Private Function GetTempRange(Strng) 'format: ' ## -> ## ' ##s -> #5 ' ## to ## -> avg ' lower ##s -> #2 ' mid ##s -> #5 ' upper ##s -> #8 ' mid to lower ##s -> #3 ' mid to upper ##s -> #7 ' lower to mid ##s -> #2 ' upper to mid ##s -> #8 ' lower teens -> 13 ' upper teens ->19 ' mid teens -> 16 ' ignore "in the" Dim procstr procstr=Strng Dim rt rt=-1000 If Instr(procstr,"'")<>0 Then procstr=Left(procstr,Instr(procstr,"'")-1)+Mid(procstr,Instr(procstr,"'")+1) End If If Instr(procstr,"teens")<>0 Then rt=16 If Instr(procstr,"lower")<>0 Then rt=13 If Instr(procstr,"upper")<>0 Then rt=19 Else If Instr(procstr,"mid to lower ")<>0 Then If Instr(procstr,"0s")<>0 Then rt=GetNumber(mid(procstr,Instr(procstr,"mid to lower")+12),1)+3 End If ElseIf Instr(procstr,"mid to upper ")<>0 Then If Instr(procstr,"0s")<>0 Then rt=GetNumber(mid(procstr,Instr(procstr,"mid to upper ")+12),1)+7 End If ElseIf Instr(procstr,"lower to mid ")<>0 Then If Instr(procstr,"0s")<>0 Then rt=GetNumber(mid(procstr,Instr(procstr,"mid to upper ")+12),1)+2 End If ElseIf Instr(procstr,"upper to mid ")<>0 Then If Instr(procstr,"0s")<>0 Then rt=GetNumber(mid(procstr,Instr(procstr,"mid to upper ")+12),1)+8 End If ElseIf Instr(procstr,"mid ")<>0 Then If Instr(procstr,"0s")<>0 Then rt=GetNumber(mid(procstr,Instr(procstr,"mid ")+4),1)+5 End If ElseIf Instr(procstr,"lower ")<>0 Then If Instr(procstr,"0s")<>0 Then rt=GetNumber(mid(procstr,Instr(procstr,"lower ")+6),1)+2 End If ElseIf Instr(procstr,"upper ")<>0 Then If Instr(procstr,"0s")<>0 Then rt=GetNumber(mid(procstr,Instr(procstr,"upper ")+6),1)+8 End If ElseIf Instr(" "+procstr,"0s")<>0 Then rt=GetNumber(mid(" "+procstr,Instr(" "+procstr,"0s")-2),1)+5 ElseIf Instr(procstr," to ")<>0 Then procstr=" "+procstr+" " Dim lt,ut lt=GetNumber(Left(procstr,Instr(procstr," to ")-1),1) ut=GetNumber(Mid(procstr,Instr(procstr," to ")+4),1) If lt<>-1000 and ut<>-1000 then rt=Int((lt+ut)/2+0.5) End If Else rt=GetNumber(procstr,1) End If End If GetTempRange=rt End Function Private Sub FolsomWeatherUpdate() Dim FSO,TextStream Set FSO=CreateObject("Scripting.FileSystemObject") Dim Page1Text Set TextStream=FSO.OpenTextFile("c:\FolsomWeather\preindex2.htm",FORREADING,True) Page1Text=TextStream.ReadAll TextStream.Close Set TextStream=Nothing With Portfolio.VWS Dim CSVTime CSVTime=vbFormat(.LastData(6),"00") If .LastData(5)=0 Then CSVTime="12:"+CSVTime+"AM" ElseIf .LastData(5)<12 Then CSVTime=vbFormat(.LastData(5),"00")+":"+CSVTime+"AM" ElseIf .LastData(5)=12 Then CSVTime="12:"+CSVTime+"PM" Else CSVTime=vbFormat(.LastData(5)-12,"00")+":"+CSVTime+"PM" End If Call Replace(Page1Text,"///TIME\\\",CSVTime) Call Replace(Page1Text,"///DATE\\\",vbFormat(.LastData(3),"0")+"/"+ _ vbFormat(.LastData(4),"0")+"/"+vbFormat(.LastData(2),"0") ) Call Replace(Page1Text,"/OT\",vbFormat(.LastData(14),"0")) Dim CSVWind Dim CSVCompass If .LastData(47)<=22.5 Or .LastData(47)>337.5 Then CSVCompass="North" If .LastData(47)>22.5 And .LastData(47)<=67.5 Then CSVCompass="Northeast" If .LastData(47)>67.5 And .LastData(47)<=112.5 Then CSVCompass="Ease" If .LastData(47)>112.5 And .LastData(47)<=157.5 Then CSVCompass="Southeast" If .LastData(47)>157.5 And .LastData(47)<=202.5 Then CSVCompass="South" If .LastData(47)>202.5 And .LastData(47)<=247.5 Then CSVCompass="Southwest" If .LastData(47)>247.5 And .LastData(47)<=292.5 Then CSVCompass="West" If .LastData(47)>292.5 And .LastData(47)<=337.5 Then CSVCompass="Northwest" If .LastData(46)<0.1 Then CSVWind="Calm" Else CSVWind=CSVCompass+" at "+vbFormat(.LastData(46),"0")+" mph. "+vbFormat(.LastData(48),"0")+" mph gust" End If Call Replace(Page1Text,"///WIND\\\",CSVWind) Call Replace(Page1Text,"///OUTSIDE HUMIDITY\\\",vbFormat(.LastData(12),"0")+"%") Call Replace(Page1Text,"///BAROMETER\\\",vbFormat(.LastData(55),"0.00")+" inHg") Call Replace(Page1Text,"///DEW POINT\\\",vbFormat(.LastData(32),"0 °F")) Call Replace(Page1Text,"///DAILY RAIN\\\",vbFormat(.LastData(17),"0.00")+Chr(34)) End With Dim c c=Portfolio.VWS.LastData(19) Dim clock clock=CDbl(Now) clock=clock-Int(clock) Dim CurrentConditions Select Case c Case 0 CurrentConditions="Clear" Case 1 CurrentConditions="Few Clouds" Case 2 CurrentConditions="Scattered Clouds" Case 3 CurrentConditions="Mostly Cloudy" Case 4 CurrentConditions="Overcast" Case 5 CurrentConditions="Drizzle" Case 6 CurrentConditions="Rain" Case 7 CurrentConditions="Frozen Rain" Case 8 CurrentConditions="Showers" Case 9 CurrentConditions="Mist" Case 10 CurrentConditions="Tornado" Case 11 CurrentConditions="Fog" Case 12 CurrentConditions="Smoke" Case 13 CurrentConditions="Hail" Case 14 CurrentConditions="Haze" Case 15 CurrentConditions="Ice Crystals" Case 16 CurrentConditions="Sand" Case 17 CurrentConditions="Snow Grains" Case 18 CurrentConditions="Snow" Case 19 CurrentConditions="Snow Showers" Case 20 CurrentConditions="Lighning" Case 21 CurrentConditions="Thunderstorms" Case Else End Select Call Replace(Page1Text,"///CONDITIONS\\\",CurrentConditions) If clock>=Sunrise and clock<=Sunset then 'Daytime icons Call Replace(Page1Text,"iconcc.jpg","icon"+vbFormat(c,"00")+"d.jpg") Else 'Nighttime icons Call Replace(Page1Text,"iconcc.jpg","icon"+vbFormat(c,"00")+"n.jpg") End If Set TextStream=FSO.OpenTextFile("c:\vws1021\root\index2.htm",FORWRITING,True) 'Forecast update If NumberOfDays>=0 Then Call Replace(Page1Text,"///FORECAST DAY\\\",DayText(0)) Dim i Dim Forecast For i=0 to SentNumber(0) Forecast=Forecast+Ucase(Left(Sent(0,i),1))+Mid(Sent(0,i),2)+"." If i<>SentNumber(0) then Forecast=Forecast+" " Next Call Replace(Page1Text,"///FORECAST\\\",Forecast) If DayDayNight(0)=0 then 'Daytime icons Call Replace(Page1Text,"iconfc.jpg","icon"+vbFormat(DayIconNumber(0),"00")+"d.jpg") Else 'Nighttime icons Call Replace(Page1Text,"iconfc.jpg","icon"+vbFormat(DayIconNumber(0),"00")+"n.jpg") End If End If TextStream.Write Page1Text TextStream.Close Set TextStream=Nothing Set FSO=Nothing End Sub Private Sub Replace(ByRef OriginalString, SearchString, ReplacementString) While Instr(OriginalString,SearchString) OriginalString=Left(OriginalString,Instr(OriginalString,SearchString)-1)+ReplacementString+ _ Mid(OriginalString,Instr(OriginalString,SearchString)+Len(SearchString)) Wend End Sub