I made a *really* simple script to parse the daily email messages I signed up for from Pollen.com
I then put the pollen count and types in a device string. I then use this on my web page and for a morning weather report.
I use the second script as a function in my morning (spoken) weather reports. It will strip off all the HTML crap so it sounds correct.
I call it like this:
<pre class="ip-ubbcode-code-pre">system.speak "The Pollen for today is " & FixPollen(hs.DeviceString(Pollen))</pre>
I made this as I was using the AirQuality script, but it broke due to recent changes on their web page.
Steps:
<UL TYPE=SQUARE>
<LI>1> Sign up for daily email alerts at www.pollen.com, also find the correct link to your local forecasts.
<LI>2> Insert the first part of this script into whatever script you use to parse inbound mail. If you don't have one, you will need to setup an event triggered on inbound email, then put this script in the script box, you will need to put a "Sub Main()" in the front and an "End Sub" at the end.
<LI>3> Change the variables PollenDevice and Pollenlink to match your system, also replace the 'CA:' where indicated.[/list]
First Script (insert into inbound email script)
<pre class="ip-ubbcode-code-pre">
Msgindex = hs.MailTrigger 'remove if these already exist in your script
MsgSubject = hs.MailSubject(MsgIndex) 'remove if these already exist in your script
MsgFrom = hs.MailFrom(MsgIndex) 'remove if these already exist in your script
MsgText = hs.MailText(MsgIndex) 'remove if these already exist in your script
' ************************************************************ ******************
' ************* Pollen Alert Parser - Sign up for daily alerts at www.pollen.com
'* Change PollenLink and PollenDevice to match your system
' ************************************************************ ******************
if instr(ucase(MsgSubject),"ALLERGY") then
t1 = instr(ucase(MsgText),"CA:") '** Change the CA: to your state ***
Tmp = mid(msgtext,t1+5,255)
t1 = instr(Tmp,vbNewLine)
Tmp2 = mid(tmp,1,t1)
PollenLink = "<a href='http://www.pollen.com/Pollen.com.asp?view=forecast&zip=95630&affid=0' target='_blank'>"
PollenDevice = "q10"
if instr(ucase(tmp2),"HIGH") then
tmp2 = replace(tmp2,"High",PollenLink & "<font color=red><b>High</font></b></a>",1,-1,1)
elseif instr(ucase(tmp2),"MEDIUM") then
tmp2 = replace(tmp2,"Medium",PollenLink & "<font color=yellow><b>Medium</font></b></a>",1,-1,1)
elseif instr(ucase(tmp2),"LOW") then
tmp2 = replace(tmp2,"Low",PollenLink & "<font color=green><b>Low</font></b></a>",1,-1,1)
end if
t1 = instr(ucase(tmp),"POLLEN:")
Tmp3 = mid(tmp,t1+9,100)
t2 = instr(Tmp3,vbNewLine)
Tmp3 = mid(tmp3,1,t2)
hs.setdeviceLastChange PollenDevice, now
hs.setdevicestring PollenDevice, tmp2 & "<br>" & tmp3
' hs. writelog "Pollen", "Pollen Alert Received: " & tmp2 & tmp3
end if
</pre>
Second Script/function:
<pre class="ip-ubbcode-code-pre">
Function FixPollen(Text)
Text = replace(text,"<br>"," ")
Text = replace(text,"<a href='http://www.pollen.com/Pollen.com.asp?view=forecast&zip=95630&affid=0' target='_blank'>","")
Text = replace(text,"<font color=red><b>High</font></b></a>"," High ")
Text = replace(text,"<font color=yellow><b>Medium</font></b></a>"," Medium ")
Text = replace(text,"<font color=green><b>Low</font></b></a>"," Low ")
FixPollen = Text
End Function
</pre>
I then put the pollen count and types in a device string. I then use this on my web page and for a morning weather report.
I use the second script as a function in my morning (spoken) weather reports. It will strip off all the HTML crap so it sounds correct.
I call it like this:
<pre class="ip-ubbcode-code-pre">system.speak "The Pollen for today is " & FixPollen(hs.DeviceString(Pollen))</pre>
I made this as I was using the AirQuality script, but it broke due to recent changes on their web page.
Steps:
<UL TYPE=SQUARE>
<LI>1> Sign up for daily email alerts at www.pollen.com, also find the correct link to your local forecasts.
<LI>2> Insert the first part of this script into whatever script you use to parse inbound mail. If you don't have one, you will need to setup an event triggered on inbound email, then put this script in the script box, you will need to put a "Sub Main()" in the front and an "End Sub" at the end.
<LI>3> Change the variables PollenDevice and Pollenlink to match your system, also replace the 'CA:' where indicated.[/list]
First Script (insert into inbound email script)
<pre class="ip-ubbcode-code-pre">
Msgindex = hs.MailTrigger 'remove if these already exist in your script
MsgSubject = hs.MailSubject(MsgIndex) 'remove if these already exist in your script
MsgFrom = hs.MailFrom(MsgIndex) 'remove if these already exist in your script
MsgText = hs.MailText(MsgIndex) 'remove if these already exist in your script
' ************************************************************ ******************
' ************* Pollen Alert Parser - Sign up for daily alerts at www.pollen.com
'* Change PollenLink and PollenDevice to match your system
' ************************************************************ ******************
if instr(ucase(MsgSubject),"ALLERGY") then
t1 = instr(ucase(MsgText),"CA:") '** Change the CA: to your state ***
Tmp = mid(msgtext,t1+5,255)
t1 = instr(Tmp,vbNewLine)
Tmp2 = mid(tmp,1,t1)
PollenLink = "<a href='http://www.pollen.com/Pollen.com.asp?view=forecast&zip=95630&affid=0' target='_blank'>"
PollenDevice = "q10"
if instr(ucase(tmp2),"HIGH") then
tmp2 = replace(tmp2,"High",PollenLink & "<font color=red><b>High</font></b></a>",1,-1,1)
elseif instr(ucase(tmp2),"MEDIUM") then
tmp2 = replace(tmp2,"Medium",PollenLink & "<font color=yellow><b>Medium</font></b></a>",1,-1,1)
elseif instr(ucase(tmp2),"LOW") then
tmp2 = replace(tmp2,"Low",PollenLink & "<font color=green><b>Low</font></b></a>",1,-1,1)
end if
t1 = instr(ucase(tmp),"POLLEN:")
Tmp3 = mid(tmp,t1+9,100)
t2 = instr(Tmp3,vbNewLine)
Tmp3 = mid(tmp3,1,t2)
hs.setdeviceLastChange PollenDevice, now
hs.setdevicestring PollenDevice, tmp2 & "<br>" & tmp3
' hs. writelog "Pollen", "Pollen Alert Received: " & tmp2 & tmp3
end if
</pre>
Second Script/function:
<pre class="ip-ubbcode-code-pre">
Function FixPollen(Text)
Text = replace(text,"<br>"," ")
Text = replace(text,"<a href='http://www.pollen.com/Pollen.com.asp?view=forecast&zip=95630&affid=0' target='_blank'>","")
Text = replace(text,"<font color=red><b>High</font></b></a>"," High ")
Text = replace(text,"<font color=yellow><b>Medium</font></b></a>"," Medium ")
Text = replace(text,"<font color=green><b>Low</font></b></a>"," Low ")
FixPollen = Text
End Function
</pre>