Announcement

Collapse
No announcement yet.

Need help with hs.geturl script.

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

    Need help with hs.geturl script.

    Hello all,

    //Solved!
    I added a try parameter and it works.



    i have made a little script to retrieve information from a site..
    this little script wil be put in my main big script for ANPR support.

    here is the example

    Code:
    Sub Main(ByVal Parms As Object)
    
      Dim strSite = "http://thisisatest.com"
      Dim teken As String = hs.devicestring (2947)
      Dim strDocument =  "/test/catalogsearch/result/?q=" &teken
      Dim strBody
      Dim x
    
      
      strBody = hs.GetUrl(strSite,strDocument,false,80)
    
      x = Instr(1,strBody,"note-msg",1)
      strBody = Mid(strBody,x)
      x = Instr(1,strBody, ">",1) + 4
     strBody = Mid(strBody,x)
    x = Instr(1,strBody, "</",1) - 1
    strBody = Mid(strBody,1,x)
     
    
    
     
    hs.writelog("debug", "Read: " & strBody)
    
    
    
    
    end sub

    I see that "note-msg" does not exist on a match.. how can i fix it ?

    If it does not have a match it shows up (no results found)
    But if i have a match i get that error.

    Code:
    Running script C:\Program Files (x86)\HomeSeer HS3\scripts\test.vb :Exception has been thrown by the target of an invocation.Argument 'Start' must be greater than zero.
    How can i change it like if it has a match it returns with hs.writelog Match found?

    I hope some1 can help me , this is the last bit of my huge ANPR script, then its complete after many many hours of work.

    regards.
    Last edited by Malosa; September 19, 2017, 06:15 AM.
    Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
    Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




    HS3Pro 4.1.14.0 on windows 10 enterprise X64 on hp quadcore laptop 8 GB.
Working...
X