Change sound volume using ctrl/

Find and share HowTos to various installations / configurations!
3 posts • Page 1 of 1
NFedorenko
Posts:45
Joined: Wed Jun 15, 2016 5:41 pm

Change sound volume using ctrl/

Post by NFedorenko »

Hello to all!

There is an intereting task to change system sound volume through WinCC OA.
Is there any way to do that?

Or maybe any advices? B)

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Change sound volume using ctrl/

Post by leoknipp »

When using Linux you can probably do it with the command "pactl" or "alsamixer".
For Windows you have to install some 3rd party software or implement your own tool.

Best Regards
Leopold Knipp
Senior Support Specialist

ozangor
Posts:44
Joined: Thu Sep 22, 2011 2:57 pm

Re: Change sound volume using ctrl/

Post by ozangor »

There is this small cmdline application nircmd.
You can call the commands by using "system()" function of wccoa.

Code: Select all

btnClicked(string name, const mapping& event)
{
  string command = "nircmd ";
  switch(name)
  {
    case "btnVolumeUp":
    {
      command += "changesysvolume 5000";
      break;
    }
    case "btnVolumeDown":
    {
      command += "changesysvolume -5000";
      break;
    }
    case "btnMute":
    {
      command += "mutesysvolume 1";
      break;
    }
    case "btnUnmute":
    {
      command += "mutesysvolume 0";
      break;
    }
  }
  system(command);
}
This has a lot of utility functions to play with. However, make sure the license is ok for your usage.

This is applicable only for Windows though.

3 posts • Page 1 of 1