Announcement

Collapse
No announcement yet.

Need help with a parm in a script

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

  • Need help with a parm in a script

    Hi all ,

    i created a huge script , so when i insert in parm PIR it triggers the pir part , and when i set Smoke it triggers the smoke part , but how can i set it up to trigger them both or seperate.. just whenever i want?


    but cant use it separate anymore , it only listens to both together... anyone a solution?
    Last edited by Malosa; August 4th, 2016, 11:21 AM. Reason: SOLVED :D
    Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
    Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




    HS3Pro 3.0.0.531 on windows 7 ultimate X64 on hp quadcore laptop 8 GB.

  • #2
    i use it for this ,

    after this :
    Sub Main(ByVal Parms As Object)

    i put this line :
    if parms="pir" then

    and the END IF at the end of the first script line.

    i just need to know how i can use both names together when i call the script ,and separate.

    if i put it like this nothing happens

    if parms="pir" then
    if parms="pir,smoke" then
    Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
    Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




    HS3Pro 3.0.0.531 on windows 7 ultimate X64 on hp quadcore laptop 8 GB.

    Comment


    • #3
      Try changing:

      Sub Main(ByVal Parms As Object)

      to

      Sub Main(ByVal Parms As String)

      Also, see the last post in this thread for a script that deals with a variable number of parameters: http://board.homeseer.com/showthread.php?t=172875.

      Cheers
      Al
      HS 3.0.0.532: 1963 Devices 1141 Events
      Z-Wave 3.0.1.261: 122 Nodes on one Z-Net

      Comment


      • #4
        Hi Al

        thanks for the reply

        it still don't work .

        im doing like this :


        Sub Main(ByVal Parms As String)
        if parms="pir" then
        TRY

        REST SCRIPT 1 HERE

        END TRY
        END IF

        TRY
        if parms="smoke" then

        REST SCRIPT 2 HERE

        END TRY
        END IF
        END SUB

        In the parameters i can put pir or smoke , it works , but not both..

        Originally posted by sparkman View Post
        Try changing:

        Sub Main(ByVal Parms As Object)

        to

        Sub Main(ByVal Parms As String)

        Also, see the last post in this thread for a script that deals with a variable number of parameters: http://board.homeseer.com/showthread.php?t=172875.

        Cheers
        Al
        Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
        Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




        HS3Pro 3.0.0.531 on windows 7 ultimate X64 on hp quadcore laptop 8 GB.

        Comment


        • #5
          Try using "contains" instead of equal. You can find some examples here:
          http://vb.net-informations.com/strin...g_Contains.htm
          Fred

          HomeSeer Pro 3.0.0.478, HS3Touch, Zwave 3.0.1.252, Envisalink DSC 3.0.0.40, WeatherXML, Z-stick, HS phone, Way2Call

          Comment


          • #6
            all thanks for the reply , i found it out already


            if parms="pir" or parms="pir,smoke" then

            this solves the problem
            Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
            Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




            HS3Pro 3.0.0.531 on windows 7 ultimate X64 on hp quadcore laptop 8 GB.

            Comment


            • #7
              Here is an example:

              PHP Code:
              Sub Main(ByVal parms As String)

                  If 
              parms.Contains("pir"Then

                      
              'REST SCRIPT 1 HERE
                  End If


                  If parms.Contains("smoke") Then

                      '
              REST SCRIPT 2 HERE

                  End 
              If

              End Sub 
              Remember, what you enter for the parms string will be case sensitive so 'pir' will work but 'PIR' would not.

              To get around that, you can do the following:

              PHP Code:
              Sub Main(ByVal parms As String)

                  If 
              parms.ToLower.Contains("pir"Then

                      
              'REST SCRIPT 1 HERE
                  End If


                  If parms.ToLower.Contains("smoke") Then

                      '
              REST SCRIPT 2 HERE

                  End 
              If

              End Sub 
              Now the parms can be set to 'pir' 'PIR' 'pIr' etc.
              Jon

              Comment


              • #8
                Hi Jon,

                many thanks again,

                i never knew about this one .ToLower.Contains

                That also solves my other scripts aswell !!!


                thanks !




                Originally posted by jon00 View Post
                Here is an example:

                PHP Code:
                Sub Main(ByVal parms As String)

                    If 
                parms.Contains("pir"Then

                        
                'REST SCRIPT 1 HERE
                    End If


                    If parms.Contains("smoke") Then

                        '
                REST SCRIPT 2 HERE

                    End 
                If

                End Sub 
                Remember, what you enter for the parms string will be case sensitive so 'pir' will work but 'PIR' would not.

                To get around that, you can do the following:

                PHP Code:
                Sub Main(ByVal parms As String)

                    If 
                parms.ToLower.Contains("pir"Then

                        
                'REST SCRIPT 1 HERE
                    End If


                    If parms.ToLower.Contains("smoke") Then

                        '
                REST SCRIPT 2 HERE

                    End 
                If

                End Sub 
                Now the parms can be set to 'pir' 'PIR' 'pIr' etc.
                Preferred -> Jon's Plugins, Pushover, Phlocation, Easy-trigger,
                Rfxcom, Blade Plugins, Pushbullet, homekit, Malosa Scripts




                HS3Pro 3.0.0.531 on windows 7 ultimate X64 on hp quadcore laptop 8 GB.

                Comment


                • #9
                  The other nice thing about "contains" is that it doesn't care in what order the parms are passed. So in your case, any of the following would work the same:

                  pir, smoke
                  smoke, pir
                  pir smoke
                  "pir" "smoke"
                  "pir smoke"

                  Etc. etc.
                  Fred

                  HomeSeer Pro 3.0.0.478, HS3Touch, Zwave 3.0.1.252, Envisalink DSC 3.0.0.40, WeatherXML, Z-stick, HS phone, Way2Call

                  Comment

                  Working...
                  X