Announcement

Collapse

Contacting HomeSeer This Week

HomeSeer is open and operational this week. All orders are being processed and shipped as usual. However, some staff are working from home. If you need to contact HomeSeer for support or customer service, please use our Email or Chat options. https://homeseer.com/contact-us/
See more
See less

Converting scripts Help Please

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

  • Converting scripts Help Please

    How do you convet a simple script like this to a .vb script


    Thanks

    Thom

    PHP Code:
    Sub main() 
    Dim Path 
    Dim Pathloc 
    Dim strng 
    Dim Stcolor 
    Path
    ="http://192.168.0.1" 
    Pathloc="/status/status_bar.html" 
    strng=hs.GetURL(Path,Pathloc,False,80
    Stcolor=hs.stringitem (strng,2,"src=/fs/images/"
    Stcolor=hs.stringitem (Stcolor,1,".GIF"
    If 
    Lcase(Stcolor)="green" then 
        hs
    .SetDeviceString "s55""<img src='/images/green.gif'> <font color='Green'> Satellite Up" 
    elseif Lcase(Stcolor)="yellow" then 
        hs
    .SetDeviceString "s55""<img src='/images/yellow.gif'> <font color='Yellow'> Satellite Degraded" 
        
    hs.Speak "Direc Way Is Reporting That The Satellite Signal Is Degraded" 
    elseif Lcase(Stcolor)="red" then 
        hs
    .SetDeviceString "s55""<img src='/images/red.gif'> <font color='Red'> Satellite Down" 
        
    hs.Speak "Direc Way Is Reporting That The Satellite Signal Is Down" 
    end if 
    end sub 

  • #2
    Try this. It's untested but should be close
    PHP Code:
    public Sub Main(sender as object)
    Dim Path as string
    Dim Pathloc 
    as string
    Dim strng 
    as string
    Dim Stcolor 
    as string
    Path
    ="http://192.168.0.1" 
    Pathloc="/status/status_bar.html" 
    strng=hs.GetURL(Path,Pathloc,False,80
    Stcolor=hs.stringitem (strng,2,"src=/fs/images/"
    Stcolor=hs.stringitem (Stcolor,1,".GIF"
    If 
    Lcase(Stcolor)="green" then 
        hs
    .SetDeviceString "s55""<img src='/images/green.gif'> <font color='Green'> Satellite Up" 
    elseif Lcase(Stcolor)="yellow" then 
        hs
    .SetDeviceString "s55""<img src='/images/yellow.gif'> <font color='Yellow'> Satellite Degraded" 
        
    hs.Speak "Direc Way Is Reporting That The Satellite Signal Is Degraded" 
    elseif Lcase(Stcolor)="red" then 
        hs
    .SetDeviceString "s55""<img src='/images/red.gif'> <font color='Red'> Satellite Down" 
        
    hs.Speak "Direc Way Is Reporting That The Satellite Signal Is Down" 
    end if 
    end sub 
    -Rupp
    sigpic

    Comment


    • #3
      Rupp I am getting this error and this seems to be what I keep running into.

      <TABLE cellSpacing=2 cellPadding=0 width="100%" border=0><TBODY><TR><TD class=LOGDateTime1 noWrap align=left>9/11/2006 9:25:53 PM </TD><TD class=LOGType1 align=left colSpan=3>Info </TD><TD class=LOGEntry1 align=left colSpan=8>Running script in background: Satellite Signal.vb</TD></TR><TR><TD class=LOGDateTime0 noWrap align=left>9/11/2006 9:25:53 PM </TD><TD class=LOGType0 align=left colSpan=3>Error </TD><TD class=LOGEntry0 align=left colSpan=8>Script compile error: Method arguments must be enclosed in parentheses.on line 25</TD></TR><TR><TD class=LOGDateTime1 noWrap align=left> </TD><TD class=LOGType1 align=left colSpan=3> </TD><TD class=LOGEntry1 align=left colSpan=8></TD></TR></TBODY></TABLE>

      Thanks

      Thom


      Originally posted by Rupp
      Try this. It's untested but should be close
      PHP Code:
      public Sub Main(sender as object)
      Dim Path as string
      Dim Pathloc 
      as string
      Dim strng 
      as string
      Dim Stcolor 
      as string
      Path
      ="http://192.168.0.1" 
      Pathloc="/status/status_bar.html" 
      strng=hs.GetURL(Path,Pathloc,False,80
      Stcolor=hs.stringitem (strng,2,"src=/fs/images/"
      Stcolor=hs.stringitem (Stcolor,1,".GIF"
      If 
      Lcase(Stcolor)="green" then 
      hs
      .SetDeviceString "s55""[img]http://board.homeseer.com/images/green.gif[/img] Satellite Up" 
      elseif Lcase(Stcolor)="yellow" then 
      hs
      .SetDeviceString "s55""[img]http://board.homeseer.com/images/yellow.gif[/img] Satellite Degraded" 
      hs.Speak "Direc Way Is Reporting That The Satellite Signal Is Degraded" 
      elseif Lcase(Stcolor)="red" then 
      hs
      .SetDeviceString "s55""[img]http://board.homeseer.com/images/red.gif[/img] Satellite Down" 
      hs.Speak "Direc Way Is Reporting That The Satellite Signal Is Down" 
      end if 
      end sub 
      </FONT></FONT></FONT>

      Comment


      • #4
        Thom,
        There aren't 25 lines in the script you posted. Can you post line 25 and I'll have a look.
        -Rupp
        sigpic

        Comment


        • #5
          Rupp this is the issue I used the exact script you sent and this is the error I get


          Thanks

          Thom

          Comment


          • #6
            Oh yea. HomeSeer adds some lines to the scripts. Try this:

            public Sub Main(sender as object)
            Dim Path as string
            Dim Pathloc as string
            Dim strng as string
            Dim Stcolor as string
            Path="http://192.168.0.1"
            Pathloc="/status/status_bar.html"
            strng=hs.GetURL(Path,Pathloc,False,80)
            Stcolor=hs.stringitem (strng,2,"src=/fs/images/")
            Stcolor=hs.stringitem (Stcolor,1,".GIF")
            If Lcase(Stcolor)="green" then
            hs.SetDeviceString ("s55", " Satellite Up" )
            elseif Lcase(Stcolor)="yellow" then
            hs.SetDeviceString ("s55", " Satellite Degraded")
            hs.Speak ("Direc Way Is Reporting That The Satellite Signal Is Degraded")
            elseif Lcase(Stcolor)="red" then
            hs.SetDeviceString ("s55", " Satellite Down")
            hs.Speak ("Direc Way Is Reporting That The Satellite Signal Is Down" )
            end if
            end sub
            -Rupp
            sigpic

            Comment


            • #7
              Oh yea. HomeSeer adds some lines to the scripts. Try this:
              PHP Code:
              public Sub Main(sender as object
              Dim Path as string 
              Dim Pathloc 
              as string 
              Dim strng 
              as string 
              Dim Stcolor 
              as string 
              Path
              ="http://192.168.0.1" 
              Pathloc="/status/status_bar.html" 
              strng=hs.GetURL(Path,Pathloc,False,80
              Stcolor=hs.stringitem (strng,2,"src=/fs/images/"
              Stcolor=hs.stringitem (Stcolor,1,".GIF"
              If 
              Lcase(Stcolor)="green" then 
                  hs
              .SetDeviceString ("s55""<img src='/images/green.gif'> <font color='Green'> Satellite Up"
              elseif 
              Lcase(Stcolor)="yellow" then 
                  hs
              .SetDeviceString ("s55""<img src='/images/yellow.gif'> <font color='Yellow'> Satellite Degraded"
                  
              hs.Speak ("Direc Way Is Reporting That The Satellite Signal Is Degraded")
              elseif 
              Lcase(Stcolor)="red" then 
                  hs
              .SetDeviceString ("s55""<img src='/images/red.gif'> <font color='Red'> Satellite Down")
                  
              hs.Speak ("Direc Way Is Reporting That The Satellite Signal Is Down")
              end if 
              end sub 
              -Rupp
              sigpic

              Comment


              • #8
                Thanks Rupp. It seems to be working but what did you do to fix it.


                I have several small scripts to convert and do not want to become a pest

                Thanks

                Thom

                Comment


                • #9
                  I put parens around any HS call like hs.setDeviceString ("A1","tst") and also the hs.speak call
                  -Rupp
                  sigpic

                  Comment


                  • #10
                    Rupp it seems to be working fine execpt for the icon does not show.


                    See image below


                    If Lcase(Stcolor)="green" then
                    hs.SetDeviceString ("s55", "[img]/images/Satellite/Satellitegreen.gif[/img] Satellite Up" )
                    elseif Lcase(Stcolor)="yellow" then


                    Thanks

                    Thom
                    Attached Files

                    Comment


                    • #11
                      Thom,
                      I noticed the BB changed the image tags. Try grabbing what I last posted.
                      -Rupp
                      sigpic

                      Comment

                      Working...
                      X