How do I create an AHK script that automates the following process:

1.Right click audio icon and enters "Playback devices" menu

2.Right click a specific bluetooth device

3.Disables this bluetooth device

4.Saves the settings (Click OK)

I'd of course like to do this without using automated keystrokes/clicks at specific locations. I'm trying not to use any third-party apps if possible.

I've been able to find the following script


    if toggle
        Run nircmd setdefaultsounddevice "Speakers"
        Run nircmd setdefaultsounddevice "Headphones"

which uses another 3rd party program called "nircmd." I guess I'm trying to gain some insight on how nircmd handles this kind of function, because I would rather not download it.

I'm thinking I could invoke powershell and enter the appropriate commands.

  • 1
    Please note that Super User is not a free script/code writing service. If you tell us what you have tried so far (include the scripts/code you are already using) and where you are stuck then we can try to help with specific problems. You should also read How do I ask a good question?. – DavidPostill Aug 10 '16 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.