Toggle between audio devices

Good morning!

I’m new to the UHK, its community, and to keyboard-modding/productivity-hacking/macros/etc in general, but even through the frustration of learning - slowly - I’m having fun.

I’m finding through searching online that UHK’s functionality seems limited in many respects regarding macros and the like. For example, when wanting to set up a toggle-able “auto-clicker” that just clicks my left mouse button quickly and repeatedly until turned off, I could only find recommendations for other more specialized pieces of software.

One popular recommendation I found when looking for this (and other) functions to create was AutoHotKey. I like the idea, but am still confused and frustrated by some of it (yes, I’m still enjoying the learning - that’s just me!) - namely that AHK’s macros seem to act as their own “applications” and need to be activated and kept running in the background to even work. I don’t know how to bind one of the AHK macros to a UHK key, so that’s a sticking point, for example.

On this topic, I’m specifically looking for a way to toggle between my speakers and headphones audio devices in Windows 10. Does anybody have recommendations?

I use NirCMD for such stuff.

You can do a lot with it. It doesn’t need to run in the background, and it’s pretty lightweight (276 KB).

Just find the name of the sound device you’d like to switch to in the Windows Sound Options (Speakers, Headphones, etc.), and then run commands with a macro.

setdefaultsounddevice [Device Name] {Role}
Role 1 = Multimedia Device, Role 2 = Communications Device

Here’s a quick example I tried on my system. The first command is to set the default sound device, but it leaves the previous device selected as the default communications device, so I set the second command with the {Role} parameter to switch the communications device as well. I’m sure there’s a cleaner way, but it works.

Interesting! I was looking for the same stuff but for macOS (I was thinking of creating a macro also)
If some people already did this one feel free to share aha