Announcement

Collapse
No announcement yet.

Help for simple BLUSBUIRT plugin Volume slider script

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

    Help for simple BLUSBUIRT plugin Volume slider script

    Hi, I am new at VBscripting and would need your assistance to complete the following project/script:
    It will help me to learn some basics and avoid hours of search + trial & error.


    Objective: Use a virtual slider to send a set of IRcodes via BLUSBUIRT plugin to control an amplifier volume
    • I have a set of 12 Infrared codes (volume presets) under the BLUSBUIRT plugin . they all work when triggered manually
    • The 12 Infrared codes are named VOL0 to VOL11 and the device (amplifier) is named "ATON"
    • A virtual slider has been configured with a range of 0-11, Device 1629 (works ok)
    • An event has been added to run a script whenever the value of device 1629 changes (works ok)
    • The script should simply use the new device 1629 value and trigger the appropriate infrared code (VOLx) via the BLUSBUIRT plugin.
    Here's what I have so far, which works when triggered manually and the "x" value set manually.

    would you mind helping out finalize the script (set parameter, VOLx correct format, etc.)

    Your help is much appreciated,

    Click image for larger version  Name:	Capture20.PNG Views:	0 Size:	13.0 KB ID:	1346913

    Sub Main(ByVal Parms as String)

    hs.PluginFunction("BLUSBUIRT", "", "SendIR", New Object(){"ATON","VOLx"})

    End Sub



    #2
    Try something like:

    Code:
        Sub Main(ByVal Parms As String)
            Dim dvalue As Integer = hs.DeviceValue(1629)
            If dvalue < 0 Then dvalue = 0
            If dvalue > 11 Then dvalue = 11
            hs.PluginFunction("BLUSBUIRT", "", "SendIR", New Object() {"ATON", "VOL" & dvalue.ToString & ""})
        End Sub
    Jon

    Comment


      #3
      Thanks for you help Jon, works a charm.
      This will definitely help construct similar scripts for other devices.
      Regards,

      Comment


        #4
        I am trying to use device strings instead of device values, Ive tried the below script without success.
        Device number is 1940 and I have setup multiple values/strings combinations (0=POWER OFF, 1=MUTE, etc)

        Can you help identify the typo(s) ? Am I correct assuming "POWER OFF" is the devicestring ?
        Thank you


        Sub Main(ByVal Parms As String)
        Dim sVal as String = hs.DeviceString(1940)
        hs.PluginFunction("BLUSBUIRT", "", "SendIR", New Object() {"ATON", ""& sVal &""})
        End Sub



        Reference ID 1940
        Status 0 = OFF
        Value 0 = "POWER OFF"
        String
        returns:
        Dec-20 12:53:51 AM BLUSBUIRT Error Action: was not found for device: ATON
        Which means the payload is empty.

        Comment


          #5
          If you look at the parameters that you have posted, the 'String' box is empty which is what you are sending as sVal.

          You need to get the status which is a bit more complicated.

          Try the following:

          Code:
              Sub Main(ByVal Parms As String)
                  Dim CS As Object
                  CS = hs.CAPIGetStatus(1940)
                  Dim sVal As String = CS.Status
                  hs.PluginFunction("BLUSBUIRT", "", "SendIR", New Object() {"ATON", "" & sVal & ""})
              End Sub
          Jon

          Comment


            #6
            Works perfectly, Thanks Jon.


            Comment


              #7
              123qweasd how to you get the volume to lower ? via a slider
              my volume goes up but not down.
              Paul.

              Comment


                #8
                Can you describe your current setup?
                this script allows me to control an amplifier with a good set of IR codes, including direct volume levels (ATON DLA). Otherwise you are better off with basic vol-/vol+ on/off buttons.

                Comment

                Working...
                X