What should I use to program that kind of Macro ?
You may use devcon from Microsoft
the page contain a detailed set of information about how to use it,
for your case, just put
To lists device instances of all devices that are present on the local computer.then,
to disable devices that match the specific hardware or instance ID,you can use wildcard (*)
Find what registry values your particular Macro queries, you can do this with Sysinternals Process Monitor.
For me, the calculator key on my keyboard queries the value of
which is set to "calc.exe".
C:\path\to\nircmd.exe mutesysvolume 1
C:\path\to\nircmd.exe mutesysvolume 0
or to disable
devcon disable [hardware_id]
devcon enable [hardware_id]