Announcement

Collapse
No announcement yet.

SCRIPTING NOVICE: Mute/Unmute (Take 2)

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

    SCRIPTING NOVICE: Mute/Unmute (Take 2)

    OK, let's try this again: Is there a way to mute or unmute a computer's sound card through scripting?


    Jim Speiser
    38-year veteran of Home Automation
    Still don't know squat

    #2
    Try what again? There are no built-in HS scripting commands to do so, but those functions should be accessible by .NET. A Google search found a few ways, but seems to be hit and miss. One option may be the NAudio library: https://github.com/naudio/NAudio. It has way more functionality, than just muting/unmuting but I believe it does have functions for that.
    HS 4.2.8.0: 2134 Devices 1252 Events
    Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

    Comment


      #3
      (Sigh) I guess nothing can be easy.


      Try what again?
      I had posted a much longer message under a similar title, but got no responses. I figure it was too complicated, so I tried simplifying, and got you! (No inferences to be drawn!)


      Jim Speiser
      38-year veteran of Home Automation
      Still don't know squat

      Comment


        #4
        Originally posted by JimSpy View Post
        (Sigh) I guess nothing can be easy.


        I had posted a much longer message under a similar title, but got no responses. I figure it was too complicated, so I tried simplifying, and got you! (No inferences to be drawn!)
        LOL, must have missed your first message.

        The other option (and likely much simpler) is to use this utility: https://www.nirsoft.net/utils/nircmd.html. You can run external programs through events or scripts. Run it manually first to see if it works on your system.
        HS 4.2.8.0: 2134 Devices 1252 Events
        Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

        Comment


          #5
          There's also this one: https://www.nirsoft.net/utils/sound_volume_view.html. It has a GUI, but also a command line interface.
          HS 4.2.8.0: 2134 Devices 1252 Events
          Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

          Comment


            #6
            Originally posted by sparkman View Post
            There's also this one: https://www.nirsoft.net/utils/sound_volume_view.html. It has a GUI, but also a command line interface.
            OK, I finally got back around to this. That's going to work. Now, I just have to learn how to call it in a script. Do I use the "Launch" function? And if so, how do I set the parameters? I have it as...

            Function Launch(byVal "C:\Users\Speiser's\Desktop\soundvolumeview\SoundVolumeV iew" As String, byVal "/mute" As String, byVal "" As String, byVal 0 As Integer) As Integer

            ...but of course that doesn't work.


            Jim Speiser
            38-year veteran of Home Automation
            Still don't know squat

            Comment


              #7
              Originally posted by JimSpy View Post

              OK, I finally got back around to this. That's going to work. Now, I just have to learn how to call it in a script. Do I use the "Launch" function? And if so, how do I set the parameters? I have it as...

              Function Launch(byVal "C:\Users\Speiser's\Desktop\soundvolumeview\SoundVolumeV iew" As String, byVal "/mute" As String, byVal "" As String, byVal 0 As Integer) As Integer

              ...but of course that doesn't work.
              Yes, launch will work if you are using a script or you can trigger it direct in an event as well.

              The syntax should be:

              Code:
              Dim x as Integer
              x = hs.Launch("C:\Users\Speiser's\Desktop\soundvolumeview\SoundVolumeView", "/mute", "" , 0)
              HS 4.2.8.0: 2134 Devices 1252 Events
              Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

              Comment


                #8
                Originally posted by sparkman View Post

                Yes, launch will work if you are using a script or you can trigger it direct in an event as well.

                The syntax should be:

                Code:
                Dim x as Integer
                x = hs.Launch("C:\Users\Speiser's\Desktop\soundvolumeview\SoundVolumeView", "/mute", "" , 0)
                Well, that certainly makes it easier. The online Help file makes it look like it has to be in .vb format.

                Thank you, I'll give it a try.


                Jim Speiser
                38-year veteran of Home Automation
                Still don't know squat

                Comment


                  #9
                  Originally posted by JimSpy View Post

                  Well, that certainly makes it easier. The online Help file makes it look like it has to be in .vb format.

                  Thank you, I'll give it a try.
                  You're welcome. It is still in vb format, however, the help file shows how the function is defined within the HS vb libraries/code, not how it is intended to be used.

                  Cheers
                  Al
                  HS 4.2.8.0: 2134 Devices 1252 Events
                  Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                  Comment

                  Working...
                  X