Announcement

Collapse
No announcement yet.

Air Quality script discussion

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Air Quality script discussion

    Air Quality script

    #2
    Just installed it.

    Worked perfectly.

    I like the fact that the parameters are passed in from the device instead of needing to edit the script. Nice touch.

    Impressive scripts.

    Scott

    Comment


      #3
      I also added this to my spoken morning reports. WAF +8

      I had to strip out the HTML code from the device string, but once finshed it sounded perfect.

      Here is the code I used to strip the HMTL. Both AirQuality and Pollen count use the same function.
      <pre class="ip-ubbcode-code-pre">
      Function FixAirQuality(Text)
      P1 = instr(text,"_blank'&gt;")
      text = Mid(text,p1+8,80)
      P2 = instr(text,"&lt;/a&gt;")
      text = mid(text,1,p2-1)
      FixAirQuality = text
      End Function
      </pre>

      Hope this helps,

      Scott

      Comment


        #4
        I am now geting these errors in my log:
        <pre class="ip-ubbcode-code-pre">
        11/5/2003 12:18:01 PM~!~Error~!~Script error in file: AirQuality.txt: 13:Type mismatch: 'strPollutantLevel' in line 142
        </pre>

        Nothing has really changed with my system.

        Any ideas?

        Scott

        Comment


          #5
          Will bust up a hard coded parse anytime!

          I've got a new AirQuality.txt file here - should put you back in business.
          Attached Files

          Comment


            #6
            cool... thanks for the quick fix...

            Comment


              #7
              My HS doesn't do much speaking right now, so I didn't really plan for that. sbessel, you simply parsed out the devicestring to get the text you needed. That's cool, but like my script is already, you're dependent on the format. This has made me think, for the future, I'd like to support speech as well.

              One possiblility is to put speakable text in the ALT tag for the image. I'd add the bold part below.

              &lt;img src="http://image.weather.com/web/common/pixel/66cc00.gif" align=absmiddle width=20 height=20 border=0 vspace=2 hspace=3 ALT="The air quality for York is Good. The main pollutant is OZONE."&gt;

              With that, you'd always just search for ALT=" and then the next ". Your text is in the middle. You'd also get mouseover text for the image, for whatever that's worth. (A "device tag" property would be nice - a variant that HS doesn't use, and it could contain anything the user wants to store there! I think I'll mention that to Rich for future releases.)

              A global variable is out, because that'd be lost if Hs is closed. The better way of implementing that would be to put it in a INI file. usually I think of INIs as saving configuration settings, but I suppose I could save the latest text string there. Then you could do something like:
              <pre class="ip-ubbcode-code-pre">
              value = hs.GetINISetting("AirQuality.txt","Pollen","No pollen information found.","AirQuality.ini")
              </pre>

              Any other thoughts?

              Comment


                #8
                <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by elmo:
                ...
                Any other thoughts?<HR></BLOCKQUOTE>

                I like the method I used as I can adjust the text for the way I want to 'hear' the results. I don't know of an easier or cleaner method, as I like the current web dispaly you have. When doing speach I end up formatting things differently depending on what I like to hear and at what times. Having that hard coded would mean I would just parse that string as well...

                thanks...

                Comment


                  #9
                  Looks like they changed the page again...

                  <pre class="ip-ubbcode-code-pre">
                  11/16/2003 12:18:00 PM~!~Error~!~Script error in file: AirQuality.txt: 5:Invalid procedure call or argument: 'InStr' in line 261
                  </pre>

                  Scott

                  Comment


                    #10
                    Hmmm. Working fine for me here. Do you get the error when you click the refresh buttons? If so, is it the pollen or AQ call?

                    I'll admit, I don't have any really pretty error handling in it. I think the only thing there is a check if the web page was pulled. If so, it parses, else it bails out.

                    But you're seeing a parse error it seems - as if something came down but wasn't expected.

                    If it's still failing, let me know which call and the params. I'll figure it out.

                    Comment


                      #11
                      It started happening ~10 days ago... I just figured I would wait a bit to see if it cleared up.

                      <pre class="ip-ubbcode-code-pre">
                      11/16/2003 6:18:00 PM~!~Event Trigger~!~Recurring Trigger (Get Pollen Count)
                      11/16/2003 6:18:01 PM~!~Error~!~Script error in file: AirQuality.txt: 5:Invalid procedure call or argument: 'InStr' in line 261
                      11/16/2003 6:22:00 PM~!~Event Trigger~!~Recurring Trigger (Get Air Quality)
                      11/16/2003 6:22:01 PM~!~Error~!~Script error in file: AirQuality.txt: 5:Invalid procedure call or argument: 'InStr' in line 266
                      </pre>

                      Looks like the error is in both sections.
                      I call using:
                      <pre class="ip-ubbcode-code-pre">AirQuality.txt("GetPollenLevel","95630;Q10")
                      AirQuality.txt("GetAirQualityLevel","Folsom;CA;Q11")</pre>


                      Scott

                      Comment


                        #12
                        Do you have the latest version? I think you do. It's 1.1.

                        I ask because I ran w/your params and found some unhealthy conditions! In other words, it worked fine.

                        What do you get when you click on the icons for the device - the color indicator blocks? That should launch the exact URL that the script parses. You should see a web page with your local info on it somewhere.

                        Comment


                          #13
                          I don't know either. I am running 1.1
                          You can see the errors I get, y devices are not updated.

                          If I click the link I get the correct page (and a ton of pop-ups as well)

                          I don't understand how it could work for you and not for me.

                          Maybe tonight I will download hte script again and make sure it didn't somehow get corrupted.

                          thanks,
                          Scott

                          Comment


                            #14
                            I copied over the 1.1 scripts again and same exact problem...

                            Comment


                              #15
                              For grins, try using my params - "Charlotte NC 29745" and see if that works. That should not make any difference....but ya never know.

                              What's odd is that if you're able to get the page to load from the indicator icons, that should be an indicator that it'd work.

                              If you want/can, send me a copy of the string that's returned from the GetURL call. Probably the easiest way is just to email it direct. Add the following line just after the URL is loaded:

                              <pre class="ip-ubbcode-code-pre">
                              hs.SendMail "elmo@mullhouse.net",&lt;youremail&gt;,"AQ Text", strPage</pre>

                              That should do it.

                              Comment

                              Working...
                              X