Announcement

Collapse
No announcement yet.

Script to Control HST Buttons

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

    Script to Control HST Buttons

    Hi All,

    Can someone please give me an example of a simple script that would change the vaule of the "ActionWhenPressed" command of a button in HST.

    I have created one transport control screen "Play, Pause, Stop,..." etc, that I would like based on which device is selected to control the specified device. If I press the play button while my dvd player is selected the button should issue a "sendir dvd, play" command if I press the same "play" button, while my FIOS is selected, it should send a "sendir fios, play" command and ETC.

    any help would be greatly appreciated.

    #2
    I don't think this can be done purely inside of HSTouch, I fear you would end up with a selection of scripts and virtual devices...

    One master device that depending on its value showed what the current selected device was...so call the device Y15.

    Y15 D/Value 1 = DVD Player
    Y15 D/Value 2 = CD Player
    Y15 D/Value 3 = FIOS

    etc etc

    (To set this from HSTouch if you had a row of buttons would be quite easy, running the immediate script command &hs.setdevicevalue("Y15", 1) etc etc)

    Then when you press the play button in HS its probably easier to again run the immediate script command &hs.runex("select.vb", "Main", "Play") or &hs.runex("select.vb", "Main", "Stop")

    Select.vb should look something like the following (this is untested);

    Code:
    Sub Main(ByVal Parms As String)
    
    Select Case Parms
    Case "Play"
    Select Case hs.devicevalue("Y15")
    Case 1
    hs.sendIR("DVDPlayer", "Play")
    Case 2
    hs.sendIR("CDPlayer", "Play")
    Case 3
    hs.sendIR("FIOS", "Play")
    Case Else
    hs.writelog("IR", "Unrecognized device for play command - check the script/call")
    End Select
    
    Case "Stop"
    Select Case hs.devicevalue("Y15")
    Case 1
    hs.sendIR("DVDPlayer", "Stop")
    Case 2
    hs.sendIR("CDPlayer", "Stop")
    Case 3
    hs.sendIR("FIOS", "Stop")
    Case Else
    hs.writelog("IR", "Unrecognized device for stop command - check the script/call")
    End Select
    
    End Select
    End Sub
    That would be the sort of principle i'd go for - you could perhaps shorten it to make it slightly more efficient but generally i'd go Check Command - > Check Selected Device - > Run IR command. Can't really show it too well above - but its a kind've nested select script that calls a second select...case function inside a larger one..

    Comment

    Working...
    X