Macro that disable / enable sound device in Windows 7

3

2

What should I use to program that kind of Macro ?

Peter

Posted 2009-10-26T00:18:47.773

Reputation:

Answers

2

Autohotkey!

Look up the "SoundSet" function to achieve what you want here.

Phoshi

Posted 2009-10-26T00:18:47.773

Reputation: 22 001

1Can I do this without a program like AutoHotKey, I can do macros with my Razer Tarantula I'd like to use that if possible – None – 2009-10-26T00:23:05.633

You asked what program you could do it with, I gave you an answer. If you don't want a certain type of answer, put that in the question, Razer Tarantula we're not telepaths. I've never used such a keyboard, so I don't know, but AHK would still be fit for the task. – Phoshi – 2009-10-26T00:55:24.367

I'm trying at the moment and I can't seem to make it work with Windows 7 sound devices – None – 2009-10-26T00:59:29.423

I listed all the sound devices, a few are there but not the one I want to change settings, I'm using USB headphones – None – 2009-10-26T01:04:13.680

1

You may use devcon from Microsoft

The DevCon utility is a command-line utility that acts as an alternative to Device Manager. Using DevCon, you can enable, disable, restart, update, remove, and query individual devices or groups of devices. DevCon also provides information that is relevant to the driver developer and is not available in Device Manager.

the page contain a detailed set of information about how to use it,

for your case, just put

devcon find *

To lists device instances of all devices that are present on the local computer.then,

devcon disable <your-sound-card-HardwareID>

to disable devices that match the specific hardware or instance ID,you can use wildcard (*)

user8228

Posted 2009-10-26T00:18:47.773

Reputation:

1

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

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AppKey\18\ShellExecute

which is set to "calc.exe".

Change that value to use NirCmd to mute the device or the previously mentioned DevCon to disable the device.

example:

to mute

C:\path\to\nircmd.exe mutesysvolume 1

to unmute

C:\path\to\nircmd.exe mutesysvolume 0

or to disable

devcon disable [hardware_id] 

and re-enable

devcon enable [hardware_id] 

John T

Posted 2009-10-26T00:18:47.773

Reputation: 149 037