Announcement

Collapse
No announcement yet.

[VB.NET] my.Alert

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

  • fungun
    replied
    I need to get rid of a % sign in a scrapped string so I can set the value the same as the device string.
    Here is the ini section for it.
    PHP Code:
    [Clouds]
    URL=http://www.accuweather.com/en/us/arnolds-park-ia/51331/current-weather/22514_pc
    RegExSearch=<li>Cloud Cover: <strong>(?<number>[0-9]{1,3}\%)</strong>
    RegExReplace=number
    DeviceString
    =I45
    Content
    =92
    The device string now reads 92%

    Thanks,
    Tim

    Leave a comment:


  • jon00
    replied
    Originally posted by waynehead99 View Post
    I just stumbled across this and was looking to download it, but it appears the link is broken...
    FYI, it is a HS2 script. Is that what you want?

    The equivalent in HS3 is either Web-scraper plugin in the updater or my DataScraper script on my site.

    Leave a comment:


  • waynehead99
    replied
    I just stumbled across this and was looking to download it, but it appears the link is broken...

    Leave a comment:


  • jon00
    replied
    Originally posted by fungun View Post
    Well, that's it. I tried to open those links with IE on the HS2 pc and the page can not be displayed.
    Guess I'll have to wait till I get a new PC.

    Tim
    Just tried it here on an old XP PC and get the same result.

    Leave a comment:


  • fungun
    replied
    Well, that's it. I tried to open those links with IE on the HS2 pc and the page can not be displayed.
    Guess I'll have to wait till I get a new PC.

    Tim

    Leave a comment:


  • fungun
    replied
    Thank you for trying.
    I am a bit puzzled as to why your script works and the "my.Alert" script doesn't.
    Could it be, ( I thought about this last night), that my HS2 is still running on Win XP and so my Internet Explorer is too old for their website update.
    I ask because I browse those sites using Firefox but I'm sure HS is using IE to scrape it.

    Thanks,
    Tim

    Leave a comment:


  • jon00
    replied
    Seems to work fine:

    Obviously the values have changed since last night.
    Attached Files

    Leave a comment:


  • fungun
    replied
    PHP Code:
    text page

    https
    ://waterservices.usgs.gov/nwis/iv/?format=rdb&sites=06604200&parameterCd=00060,00065,00010&siteType=LK&siteStatus=all


    XML format

    https
    ://waterservices.usgs.gov/nwis/iv/?format=waterml,2.0&sites=06604200&parameterCd=00060,00065,00010&siteType=LK&siteStatus=all




    To Parse


    <wml2:MeasurementTVP><wml2:time>2017-01-05T12:45:00-06:00</wml2:time><wml2:value>1.6</wml2:value><wml2:metadata><wml2:TVPMeasurementMetadata/>



    <
    wml2:MeasurementTVP><wml2:time>2017-01-05T12:45:00-06:00</wml2:time><wml2:value>4.51</wml2:value><wml2:metadata><wml2:TVPMeasurementMetadata/> 
    I need one of the "time", then I need the "1.6" and the "4.51" values.
    Thank you for trying.

    Tim

    Leave a comment:


  • jon00
    replied
    Give me the URL details again and what you are trying to parse and I will take a look tomorrow.

    Leave a comment:


  • fungun
    replied
    jon00
    Sorry I cannot assist further unless you move it across to HS3 and use my Datascraper....
    So will your Datascraper get past the https or the ssl stuff?

    Thanks,
    Tim

    Leave a comment:


  • fungun
    replied
    Well I am assuming this script works because I get no error for the script itself.
    However I still get the same error I got from before. I won't copy the whole error, it's very long.
    So now I am under the assumption I will have to download the xml file or the tab file and then try to parse one of them.
    First the script, then the error.

    Thanks,
    Tim

    PHP Code:
    Imports System.XML
    '*************************************************************************
    '
    wunderground_XML.vb Pull the current temperature and wind from any of
    '*      multiple Weather Underground stations. (version 1.0)
    '
    By Steve Anderson (Snevl)
    '*************************************************************************

    Const lakeT_dev As String "I20"
    'Const lakeG_dev As String = "W61"

    Sub Main(ByVal Parms as Object)

        Dim lakeT as String
        '
    Dim lakeG as String
        Dim XMLdoc 
    as XMLDocument = New XMLDocument()

                
    XMLdoc.Load("https://waterservices.usgs.gov/nwis/iv/?format=waterml,2.0&sites=06604200ÂmeterCd=00060,00065,00010&siteType=LK&siteStatus=all")
            
    Dim book as XmlNode
            Dim root 
    as XmlNode XMLdoc.DocumentElement

            book
    =root.SelectSingleNode("<wml2:value>")
            
    lakeT book.InnerText        
            hs
    .SetDeviceString(lakeT_dev,lakeT,TRUE)

            
    'book=root.SelectSingleNode("//current_observation/UV")        
            '
    lakeG book.InnerText        
            
    'hs.SetDeviceString(lakeG_dev,lakeG,TRUE)

            

    End Sub 

    PHP Code:
    1/6/2017 6:14:18 PM ~!~Event~!~Running script in backgroundLakeTempStage010617.vb
    1
    /6/2017 6:14:21 PM ~!~Error~!~Scripting runtime errorSystem.Reflection.TargetInvocationExceptionException has been thrown by the target of an invocation. ---> System.Net.WebExceptionThe underlying connection was closedAn unexpected error occurred on a send. ---> System.IO.IOExceptionReceived an unexpected EOF or 0 bytes from the transport stream.   at System.Net.FixedSizeReader.ReadPacket(Byte[] bufferInt32 offsetInt32 count)   at System.Net.Security.SslState.StartReadFrame(Byte[] bufferInt32 readBytesAsyncProtocolRequest asyncRequest)   at System.Net.Security.SslState.Start 

    Leave a comment:


  • sparkman
    replied
    Originally posted by fungun View Post
    Ok , I looked at a few. Some are very old, like from 2004.
    I am getting confused on the "nodes" stuff.
    Are the "nodes" the lines you want parsed in the xml file itself?
    If so, how am I going to get 2 values that have the same "node" name?

    ex -
    PHP Code:
    <wml2:MeasurementTVP><wml2:time>2017-01-05T12:45:00-06:00</wml2:time><wml2:value>1.6</wml2:value><wml2:metadata><wml2:TVPMeasurementMetadata/>



    <
    wml2:MeasurementTVP><wml2:time>2017-01-05T12:45:00-06:00</wml2:time><wml2:value>4.51</wml2:value><wml2:metadata><wml2:TVPMeasurementMetadata/> 
    I need the 1.6 and 4.51 and just one of the date-time.

    Thanks,
    Tim
    Every element in an xml is considered a node. There is an xml function that will return all the nodes with the same name as an array. Take a look at the VB examples here: https://msdn.microsoft.com/en-us/lib...code-snippet-2

    Cheers
    Al

    Leave a comment:


  • fungun
    replied
    Ok , I looked at a few. Some are very old, like from 2004.
    I am getting confused on the "nodes" stuff.
    Are the "nodes" the lines you want parsed in the xml file itself?
    If so, how am I going to get 2 values that have the same "node" name?

    ex -
    PHP Code:
    <wml2:MeasurementTVP><wml2:time>2017-01-05T12:45:00-06:00</wml2:time><wml2:value>1.6</wml2:value><wml2:metadata><wml2:TVPMeasurementMetadata/>



    <
    wml2:MeasurementTVP><wml2:time>2017-01-05T12:45:00-06:00</wml2:time><wml2:value>4.51</wml2:value><wml2:metadata><wml2:TVPMeasurementMetadata/> 
    I need the 1.6 and 4.51 and just one of the date-time.

    Thanks,
    Tim

    Leave a comment:


  • sparkman
    replied
    Originally posted by fungun View Post
    It also looks like I can output a xml file. Maybe that would be easier. (?)

    Thanks,
    Tim

    https://waterservices.usgs.gov/nwis/...siteStatus=all
    XML is typically easy to parse. There are some great scripts floating around the forum for doing so. I think these are all written for HS3, but there may be some around for HS2 too.

    Cheers
    Al

    Leave a comment:


  • jon00
    replied
    Time you ditched that old X10 stuff and moved to HS3

    Leave a comment:

Working...
X