Announcement

Collapse
No announcement yet.

More Script Assistance

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

    More Script Assistance

    I'm trying to simplify a bit and attempting to use a script to write a device string to one device, depending on what is on or off with 4 other devices.

    PHP Code:

    sub main
    ()
    if 
    hs.IsOn("V2"then
     hs
    .SetDeviceString "V60""Mornings"True
    end 
    if
    if 
    hs.IsOn("V61"then
     hs
    .SetDeviceString "V60""Days"True
    end 
    if
    if 
    hs.IsOn("V62"then
     hs
    .SetDeviceString "V60""Evenings"True
    end 
    if
    if 
    hs.IsOn("V63"then
     hs
    .SetDeviceString "V60""Nights"True
    end 
    if
    if 
    hs.IsOff("V2"&"V61"&"V62"&"V63"then
     hs
    .SetDeviceString "V60""Silent"True
    end 
    if
    end sub 
    This one doesn't return any errors but it doesn't quite work either. I'm thinking my mistake is with the "ISOff" portion. Either i should be using something else, or I am using it incorrectly.

    Can someone point me to my error, please?
    Marty
    ------
    XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
    Playing with HS3 a bit but it's just play at this point.

    #2
    I think you need to change:

    if hs.IsOff("V2"&"V61"&"V62"&"V63") then

    to:

    if hs.IsOff("V2") & hs.IsOff("V61") & hs.IsOff("V62") & hs.IsOff("V63") then
    Jon

    Comment


      #3
      Believe it or not, I tried that and it gives me an error

      Running script, script run or compile error in file: speak mode.txt13:Type mismatch: '[string: "TrueFalseTrueTrue"]' in line 24 More info: Type mismatch: '[string: "TrueFalseTrueTrue"]'

      Considering this is like the second script I ever wrote and even then because it'll take too many events to make it happen, I'm assuming you just made a typo, as opposed to my outright blunder.
      Marty
      ------
      XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
      Playing with HS3 a bit but it's just play at this point.

      Comment


        #4
        Try this then:

        if hs.IsOff("V2")="True" & hs.IsOff("V61")="True" & hs.IsOff("V62")="True" & hs.IsOff("V63")="True" then
        Jon

        Comment


          #5
          That's the ticket. Now that i see it written, i understand what the error message was trying to tell me. Thank you very much!

          EDIT

          I was wrong, the new line while it doesn't generate any errors doesn't work either. The first part works fine, as the devices change the device string for V60 is updated to show that. It's only when they are all off that it doesn't seem to reconize.

          Maybe the script itself is flawed, even though some of it works? Is there a better way to accomplish changing the device string on my V60 device as the other four turn off or on? It's the "all off" that doesn't seem to get picked up.
          Last edited by nightwalker; June 3, 2008, 04:24 PM.
          Marty
          ------
          XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
          Playing with HS3 a bit but it's just play at this point.

          Comment


            #6
            Try this with either of the lines that Jon posted - change the "&" to "and".

            if hs.IsOff("V2") and hs.IsOff("V61") and hs.IsOff("V62") and hs.IsOff("V63") then

            jim

            Comment


              #7
              That seems to work, I tried & with and with out (), I tried + with and with out, i never did try just plain "and". A nice book of syntax would have been welcome.

              Thanks for the correction.
              Marty
              ------
              XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
              Playing with HS3 a bit but it's just play at this point.

              Comment


                #8
                Microsoft Script Help links to a free download with the vbscript/jscript/wscript help file for windoze. I use it often when I'm looking for vbscript syntax. As for vb.net, that's a different download, but is very close to vb.net for the generic stuff.

                Hope this helps. It has really helped me over the years.
                huggy_d1

                Automating made easy

                Comment


                  #9
                  & is used to concatenate two strings together. Like "Home" & "Seer" = HomeSeer
                  and is used as a logical expression. It is used when comparing 2 values.
                  💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

                  Comment


                    #10
                    Originally posted by huggy_d1 View Post
                    Microsoft Script Help links to a free download with the vbscript/jscript/wscript help file for windoze. I use it often when I'm looking for vbscript syntax. As for vb.net, that's a different download, but is very close to vb.net for the generic stuff.

                    Hope this helps. It has really helped me over the years.

                    I've just downloaded it, I hope it helps too. Thanks for the link.
                    Marty
                    ------
                    XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
                    Playing with HS3 a bit but it's just play at this point.

                    Comment


                      #11
                      Originally posted by Rupp View Post
                      & is used to concatenate two strings together. Like "Home" & "Seer" = HomeSeer
                      and is used as a logical expression. It is used when comparing 2 values.
                      That makes sense when i see it written out like that. It's never that simple of course when you're looking through lists of cryptic commands trying to not only figure out which to use but how to get them to work together.

                      I know I'll never be very good at writing scripts, just no time, but I would like to be able to do some simple things. This one was my second, not including edits, and while i still needed help, i got further than the last time.

                      Thanks everyone!
                      Marty
                      ------
                      XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
                      Playing with HS3 a bit but it's just play at this point.

                      Comment


                        #12
                        I could kick myself...most embarrassing for me ...got too absorbed in the code already written! Anyway, my original posting with '&' replaced by 'and' should work! i.e.

                        if hs.IsOff("V2") and hs.IsOff("V61") and hs.IsOff("V62") and hs.IsOff("V63") then
                        Jon

                        Comment


                          #13
                          Originally posted by jon00 View Post
                          I could kick myself...most embarrassing for me ...got too absorbed in the code already written! Anyway, my original posting with '&' replaced by 'and' should work! i.e.

                          if hs.IsOff("V2") and hs.IsOff("V61") and hs.IsOff("V62") and hs.IsOff("V63") then

                          It's been working just great, pretty much what I intended, but was unable to get to work. I like when the pro's miss one, It gives hope to the rest of us scripting challanged folks.
                          Marty
                          ------
                          XPpro SP3 /w HS Standard 2.5.0.80, HSTouch Server - 1.0.0.70, HSTouch Client 1.0.0.73 HSTouch Android - 1.0.0.2, HSTouch iPhone - 1.0.0.2
                          Playing with HS3 a bit but it's just play at this point.

                          Comment


                            #14
                            [ATTACH]16904[/ATTACH]
                            Couldn't resist this.
                            Real courage is not securing your Wi-Fi network.

                            Comment


                              #15
                              Wow - it's like looking in the mirror
                              Jon

                              Comment

                              Working...
                              X