This is one of the limitations of the Exec2 binding. I think there is an issue open to address it.
The Input and Output channels can only be linked to String Items.
The Slider element only works with Number Items (or other Items that can accept a Number as a command like Dimmer).
So you can’t directly control an Item linked to the Input or Output channel of an Exec2 thing.
Furthermore, a Slider implies an absolute volume level. If I put the slider to the middle, I expect the volume to be at 50% of the max volume. But your commands are all relative. So if you moved the slider up to 75% your volume would only go up by 5000. Eventually the range of volume that the Slider will control will narrow to the point of uselessness.
So you have two choices. You can abandon the use of the Slider and use an Up Down button (i.e. a Switch with a Mapping) or you can send absolute volume values.
The ending of your OP indicates you can send absolute values so let’s do that that.
First of all, you need only one Thing.
Thing exec:command:PCVOL [command="nircmd.exe setsysvolume %2$s, autorun=true ]
Per the docs the %2$s will be replaced with the state of the Item linked to the Input Channel.
Now you need two Items, a Dimmer Item to represent the volume and a String Item linked to the Input channel of PCVOL.
Dimmer PC_Volume "PC Volume"
String PC_Volume_Control { channel="exec:command:PCVOL:input" }
PC_Volume is a Design Pattern: Proxy Item and it the Item you will put on your sitemap and use elsewhere in your OH config to know what volume the PC is set to.
PC_Volume_Control is the Item you will sendCommand to cause the program to run.
Now you need a Rule to take the percent value that PC_Volume will get set to an absolute value to send as the argument to the executable.
rule "PC Volume"
when
Item PC_Volume changed
then
val maxVol = 100000 // whatever the max volume value is
PC_Volume_Control.sendCommand((maxVol / PC_Volume.state as Numer).intValue)
end
But you have one remaining problem. What happens when OH restarts or your machine restarts? All your Items get reset to NULL (i.e. uninitialized) which means that your PC_Volume Item will no longer know what volume your PC is currently set to.
Is there an argument you can pass to nircmd.exe to get the current system volume?
If not you will run into some problems.