Announcement

Collapse
No announcement yet.

How-To: HSTouch - Are You Sure?

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

  • drozwood90
    replied
    Basically, instead of entering the event name in the text box, put the event name ";" E to run the event. I did not like using ;, but the | must have been a key "string" that HS used. Everything after the | was being chopped off. I replaced that with the ; and everything started to work.

    Also, this can take a device NAME or device CODE ";" ON or OFF or DIM{value} (no braces...so for dim of 45, DIM45).

    Examples in the comments:

    scriptHSTouchInterface,vb

    Code:
    Private Function StringFind(ByVal strSearchIn As String, ByVal strSearchFor As String) As Boolean
        If InStr(1, strSearchIn, strSearchFor, vbTextCompare) > 0 Then
            StringFind = True
        End If
    End Function
    
    Sub Main(ByVal parm as object)
       ' String definition:
       '     [3 digit device code] 
       '      or [device location and name] 
       '      or [event name] 
       '    ; 
       '      [ON] or [OFF] 
       '      or [E] or [Evt] 
       '      or [Event] or[DIM concatenated with a dim value]
       ' examples: 
       '  ^41;ON 
       '     will execute execx10 ON for device ^41
       '  Garage Cardoor;ON
       '     performs a device lookup for Garage Cardoor, then turns it on
       '  Turn Garage Car Door On;E
       '     executes the event "Turn Garage Car Door On"
       '  ^41;DIM50
       '     will dim device ^41 by 50
       
       Dim myCommand
    
       myCommand = Split(parm(0), ";")
          
       if(StringFind(myCommand(1).ToUpper(),"E")) then
          hs.triggerEvent(myCommand(0))
       elseif(StringFind(myCommand(1).ToUpper(),"DIM")) then
          if(myCommand(0).Length() < 4) then
             hs.execx10(myCommand(0),"DIM",Split(myCommand(1).ToUpper(),"M")(1))
          else
             hs.execx10(hs.GetDeviceCode(myCommand(0)),"DIM",Split(myCommand(1).ToUpper(),"M")(1))
          end if
       else
          if(myCommand(0).Length() < 4) then
             hs.execx10(myCommand(0),myCommand(1))
          else
             hs.execx10(hs.GetDeviceCode(myCommand(0)),myCommand(1))
          end if
       end if   
       
    End Sub

    Leave a comment:


  • rmasonjr
    replied
    Originally posted by drozwood90 View Post
    I modified the script. It can now take in devices code OR name and automatically detects WHICH it needs to process - with ON/OFF/DIM as well as the event names as you had it.

    Do you want me to post it here?

    --Dan
    Ah - very nice! Of course - go ahead and post here!

    Leave a comment:


  • drozwood90
    replied
    I modified the script. It can now take in devices code OR name and automatically detects WHICH it needs to process - with ON/OFF/DIM as well as the event names as you had it.

    Do you want me to post it here?

    --Dan

    Leave a comment:


  • rmasonjr
    replied
    Thanks Dan! I just ran across this scenario myself and thought I'd share.

    Leave a comment:


  • drozwood90
    replied
    great as always! This is something I had wanted to do for a while...such as for my open the garage door "button", it is actually the live video feed of the camera that watches the door.

    So, having it "popup" to confirm would be AWESOME!

    --Dan

    Leave a comment:


  • rmasonjr
    started a topic How-To: HSTouch - Are You Sure?

    How-To: HSTouch - Are You Sure?

    Here's a way to popup an "Are You Sure??" box when pressing a button in HSTouch. There may be better ways of doing it, but this method seems to work ok for me - hope it helps.

    <iframe width="420" height="315" src="http://www.youtube.com/embed/QtprBBe-Bfg" frameborder="0" allowfullscreen></iframe>
Working...
X