Announcement

Collapse
No announcement yet.

Simple How do I send a variable to a script in HSTouch?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Simple How do I send a variable to a script in HSTouch?

    How do I send a variable to a script in HSTouch?

    I have a button/graphic in HSTouch send a value to a Script?
    When I click on a graphic (like a SyFi image) I want to trigger a Script with a variable that equals the channel Ex: TV-SelectChannel.vb("main","244"). Here is the script I wrote to set TV to the requested channel:
    ' Select Channel
    ' by JD Taylor
    ' -----------------------------------------------------------------------------------------------------------
    ' This script will send IR commands to select a channel passed to it
    '---------------------------------------------------------------------------
    ' DVR TV Channel Selection (set by strPassed)
    '---------------------------------------------------------------------------
    '
    ' Syntax is: TV-SelectChannel.vb("")
    ' where a 3 digit channel number is sent
    ' ex: TV-SelectChannel.vb("main" "004")
    ' -----------------------------------------------------------------------------------------------------------

    sub main(strPassed)
    Dim bc4 As Object = hs.Plugin("BC4 Plugin")
    Dim strDigit1 as string
    Dim strDigit2 as string
    Dim strDigit3 as string

    strDigit1 = Mid(strPassed,1,1)
    strDigit2 = Mid(strPassed,2,1)
    strDigit3 = Mid(strPassed,3,1)
    hs.WriteLog("Info","Selecting Channel " & strDigit1 & strDigit2 & strDigit3)

    if strDigit1 = "0" then strDigit1 = "10"
    if strDigit2 = "0" then strDigit2 = "10"
    if strDigit3 = "0" then strDigit3 = "10"

    ' hs.WriteLog("Info","Selecting Channel " & strDigit1 & strDigit2 & strDigit3)
    bc4.SendBC4IR(1,3,8+strDigit1) 'Digit 1
    hs.waitsecs(0.3)
    bc4.SendBC4IR(1,3,8+strDigit2) 'Digit 2
    hs.waitsecs(0.3)
    bc4.SendBC4IR(1,3,8+strDigit3) 'Digit 3
    hs.waitsecs(0.3)
    bc4.SendBC4IR(1,3,19) 'Channel Enter
    bc4 = Nothing

    End Sub

    Thanks for any help.

    #2
    Click on actionswhenpressed/released and select the action Run A HomeSeer script with values from elements.

    Instead of selecting the script from the drop down box then add the entry;

    &hs.runex("TV-SelectChannel.vb", "main","244")

    Hopefully it should work for you

    Comment


      #3
      Knew it was something simple. It worked like a charm.

      Thank you!

      Comment

      Working...
      X