Welcome Guest.   Make a donation to an author on the site November 25, 2014, 11:26:29 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
View the new Member Awards and Badges page.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1] 2 Next   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: DONE: A shortcut/hotkey to switch between audio devices?  (Read 29503 times)
moerl
Charter Member
***
Posts: 404


View Profile Give some DonationCredits to this forum member
« on: April 11, 2006, 03:11:37 AM »

How could I make switching between the Realtek device and the Sennheiser USB headset really fast? smiley

Normally, to do this, I have to do the following:

1. Click Start, Control Panel.
2. Open Sounds & Audio Devices
3. Select "Audio" tab
4. From "Sound Playback" devices choose the wanted device from the dropdown list
5. Click Apply, then OK.
6. Close control panel

In short, it's a huge pain in the ass and this really is something that I want to be able to do on the fly. Any ideas?


* 2006.04.09--02.42.17_WINDOW.png (32.17 KB, 367x455 - viewed 743 times.)
Logged
Carol Haynes
Waffles for England (patent pending)
Global Moderator
*****
Posts: 7,958



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #1 on: April 11, 2006, 03:43:29 AM »

A Macro would do it quickly
Logged

moerl
Charter Member
***
Posts: 404


View Profile Give some DonationCredits to this forum member
« Reply #2 on: April 12, 2006, 01:09:21 AM »

What kind of macro?
Logged
lanux128
Global Moderator
*****
Posts: 6,133



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #3 on: April 12, 2006, 01:36:39 AM »

What kind of macro?

e.g. this command below opens the Audio tab in your Multimedia Devices applet.
[copy or print]
RunDll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,2

maybe someone here can figure out how to change the items in the combo-box via AHK...



Logged

moerl
Charter Member
***
Posts: 404


View Profile Give some DonationCredits to this forum member
« Reply #4 on: April 12, 2006, 01:45:32 AM »

That's no bad start. No bad start at all. Thanks! Before we figure out the real deal, how could I turn the command you came up with into a shortcut that, when clicked, for example from the quicklaunch bar, would get me to that window?
Logged
lanux128
Global Moderator
*****
Posts: 6,133



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #5 on: April 12, 2006, 02:02:59 AM »

i believe that once this topic is picked by one of our AHK pros, you'll have a decent app in your hands. Wink

in the meantime, you can create a shortcut as you normally do... right-click on desktop, choose New>Shortcut. then paste the command, type an appropriate name then drag the newly-created shortcut to the quicklaunch bar.
Logged

jgpaiva
Global Moderator
*****
Posts: 4,711



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #6 on: April 12, 2006, 03:52:28 AM »

Great work lanux!
This can be easily done, if the window is opened as "hidden". But i don't know how to see which item is selected in that combobox, so, you'd always have to tell the script which device to activate, every time you ran it, and you'd have to pre-configure it to tell it how many items the combobx has. Nevertheless, it can be done.
But i think skrommel knows how to get the names in the combobox, and will come up with a great solution Wink
Logged

Carol Haynes
Waffles for England (patent pending)
Global Moderator
*****
Posts: 7,958



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #7 on: April 12, 2006, 04:56:13 AM »


e.g. this command below opens the Audio tab in your Multimedia Devices applet.
[copy or print]
RunDll32.exe shell32.dll,Control_RunDLL mmsys.cpl,,2


Great start ...

Once the window is open you can use ALT D to make sure the device field is highlighted.

If the device names start with different letters just press the first letter to select the device and press return to close the window.

An AHK script to do this would be:

[copy or print]
Run, RunDll32.exe shell32.dll`,Control_RunDLL mmsys.cpl`,`,2
Sleep, 1000
send, {alt down}d{alt up}m{enter}

where m (in the last line) is the first letter of your device name.

If you make two scripts, one for each device you can just double click the correct device when you need to swap.

You may need to fiddle with the sleep delay too on your system depending on how quickly the window opens.
« Last Edit: April 12, 2006, 04:58:16 AM by Carol Haynes » Logged

jgpaiva
Global Moderator
*****
Posts: 4,711



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #8 on: April 12, 2006, 05:04:15 AM »

Common development.. Nice.

my 0,02$:
[copy or print]
Run, RunDll32.exe shell32.dll`,Control_RunDLL mmsys.cpl`,`,2
WinWait,ahk_class #32770
send, {alt down}d{alt up}m{enter}
This code should work a little better, since it waits for the window to appear.
Logged

Carol Haynes
Waffles for England (patent pending)
Global Moderator
*****
Posts: 7,958



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #9 on: April 12, 2006, 06:09:19 AM »

Thanks - trouble with AHK is that there are just too many damn options for everything!
Logged

brotherS
Master of Good Ideas
Honorary Member
**
Posts: 2,105


To make a difference, be different.

View Profile Give some DonationCredits to this forum member
« Reply #10 on: April 12, 2006, 06:18:05 AM »

If you make two scripts, one for each device you can just double click the correct device when you need to swap.
Or you could just create one AHK script that's writing some kind of indicator to an .ini file and every time the script is executed it changes the device to the one not being selected the last time.

AHK = great smiley
Logged

Thank you.
Carol Haynes
Waffles for England (patent pending)
Global Moderator
*****
Posts: 7,958



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #11 on: April 12, 2006, 06:24:51 AM »

Actually it should be trivial to organise this to have a hotkey to do the swapping ... no time at the mo (I'm sure someone can write it in 2 secs but I need to scour the helpfiles) maybe later if no one has done it.
Logged

jgpaiva
Global Moderator
*****
Posts: 4,711



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #12 on: April 12, 2006, 06:32:10 AM »

Or you could just create one AHK script that's writing some kind of indicator to an .ini file and every time the script is executed it changes the device to the one not being selected the last time.
Yes, but that would force Moerl to switch the options only though this script, or it wouldn't do things right.

@Moer: to make a decent script, i need to know the name of the options in that box, and how many there are.
Logged

brotherS
Master of Good Ideas
Honorary Member
**
Posts: 2,105


To make a difference, be different.

View Profile Give some DonationCredits to this forum member
« Reply #13 on: April 12, 2006, 06:59:42 AM »

Or you could just create one AHK script that's writing some kind of indicator to an .ini file and every time the script is executed it changes the device to the one not being selected the last time.
Yes, but that would force Moerl to switch the options only though this script, or it wouldn't do things right.
True, but since he was referring to doing it manually as a "pain in the ass", I hardly doubt he will ever do it again without a good working script! cheesy
Logged

Thank you.
wr975
Charter Member
***
Posts: 369



View Profile Give some DonationCredits to this forum member
« Reply #14 on: April 12, 2006, 07:01:43 AM »


I think the script can act as toggle without ini. What do you think of this? (Untested).

[copy or print]
SetTitleMatchMode, Slow

Run, RunDll32.exe shell32.dll`,Control_RunDLL mmsys.cpl`,`,2
WinWait,ahk_class #32770

IfWinActive, ahk_class #32770, RealTek AC97 Audio
     send, {alt down}d{alt up}s{enter}
else
     send, {alt down}d{alt up}r{enter}
Logged
jgpaiva
Global Moderator
*****
Posts: 4,711



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #15 on: April 12, 2006, 07:05:31 AM »

Good point, wr975!
Now, I only need Moerl's audio devices' names!
Logged

moerl
Charter Member
***
Posts: 404


View Profile Give some DonationCredits to this forum member
« Reply #16 on: April 12, 2006, 03:50:12 PM »

Damn. Some sweet work has been done in here. I've never used AHK. Each time I looked at it it was too much to digest, too much to handle, so I let it be smiley.

jgpaiva: where do I get them? I'm not sure what you mean by the names.
Logged
brotherS
Master of Good Ideas
Honorary Member
**
Posts: 2,105


To make a difference, be different.

View Profile Give some DonationCredits to this forum member
« Reply #17 on: April 12, 2006, 04:00:38 PM »

Damn. Some sweet work has been done in here. I've never used AHK. Each time I looked at it it was too much to digest, too much to handle, so I let it be smiley.
Then it's time to visit the quick-start tutorial: http://www.autohotkey.com/docs/Tutorial.htm

DC wasn't built in one night, and AHK is a journey - don't hope to start it some day in the far future, just jump in and enjoy the ride!

I started with very basic stuff and am constantly learning new stuff, whenever I tackle a new challenge.
Logged

Thank you.
moerl
Charter Member
***
Posts: 404


View Profile Give some DonationCredits to this forum member
« Reply #18 on: April 12, 2006, 04:11:40 PM »

I'll get to it. I have so many things around me that need to be done Sad. I hate when that's the case smiley
Logged
moerl
Charter Member
***
Posts: 404


View Profile Give some DonationCredits to this forum member
« Reply #19 on: April 12, 2006, 04:16:41 PM »


I think the script can act as toggle without ini. What do you think of this? (Untested).

[copy or print]
SetTitleMatchMode, Slow

Run, RunDll32.exe shell32.dll`,Control_RunDLL mmsys.cpl`,`,2
WinWait,ahk_class #32770

IfWinActive, ahk_class #32770, RealTek AC97 Audio
     send, {alt down}d{alt up}s{enter}
else
     send, {alt down}d{alt up}r{enter}
Is this an AHK script or a "regular" script?

Until I figure that out, I'll try jgpaiva's solution here:
Common development.. Nice.

my 0,02$:
[copy or print]
Run, RunDll32.exe shell32.dll`,Control_RunDLL mmsys.cpl`,`,2
WinWait,ahk_class #32770
send, {alt down}d{alt up}m{enter}
This code should work a little better, since it waits for the window to appear.
Logged
Carol Haynes
Waffles for England (patent pending)
Global Moderator
*****
Posts: 7,958



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #20 on: April 12, 2006, 04:18:26 PM »

where do I get them? I'm not sure what you mean by the names.

When you open the normal window the names are the ones you select in the drop down menu. Actually they are listed in your original post LOL

The first letters are S (Senheiser) and R (Realtek) - the script above already has the right letters.

All you need to do is download and install autohotkey (http://www.autohotkey.com...oad/AutoHotkeyInstall.exe) save the script above via a text editor with .ahk as it's extension and then doubleclick the script file to toggle your sound card.

(I have attached the AHK script to this post in a zip file)

* toggle.zip (0.29 KB - downloaded 449 times.)
« Last Edit: April 12, 2006, 04:20:59 PM by Carol Haynes » Logged

moerl
Charter Member
***
Posts: 404


View Profile Give some DonationCredits to this forum member
« Reply #21 on: April 12, 2006, 04:24:22 PM »

i believe that once this topic is picked by one of our AHK pros, you'll have a decent app in your hands. Wink

in the meantime, you can create a shortcut as you normally do... right-click on desktop, choose New>Shortcut. then paste the command, type an appropriate name then drag the newly-created shortcut to the quicklaunch bar.
I thought it was that simple too.. but when I right-click the desktop and choose NEW SHORTCUT the window that appears asks me for the file's location to which I want to create a shortcut. I can't just drop the code in that line :/
Logged
Carol Haynes
Waffles for England (patent pending)
Global Moderator
*****
Posts: 7,958



see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #22 on: April 12, 2006, 04:32:48 PM »

Another way to create a shortcut is to right click on the target file and choose Send to ... >Desktop (Create Shortcut)
Logged

moerl
Charter Member
***
Posts: 404


View Profile Give some DonationCredits to this forum member
« Reply #23 on: April 12, 2006, 04:39:23 PM »

where do I get them? I'm not sure what you mean by the names.

When you open the normal window the names are the ones you select in the drop down menu. Actually they are listed in your original post LOL

The first letters are S (Senheiser) and R (Realtek) - the script above already has the right letters.

All you need to do is download and install autohotkey (http://www.autohotkey.com...oad/AutoHotkeyInstall.exe) save the script above via a text editor with .ahk as it's extension and then doubleclick the script file to toggle your sound card.

(I have attached the AHK script to this post in a zip file)
Exactly! That's why I was confused by jgpaiva's request, because I thought he meant something else still. I intentially took the screenshot with the whole dropdown list showing for the exact reason to show you all the names of the devices. Thanks for clearing that up smiley. While reading your post, I realized I wouldn't know which script to pick from above, so I'm doubly thankful that you attached it as a ZIP. Thanks smiley

Another way to create a shortcut is to right click on the target file and choose Send to ... >Desktop (Create Shortcut)
Right.. what file would that be? A new text file with the information pasted in it? Would it remain a text file or would I have to change the extension to something else? I'll check out AHK now so this is not too important.
« Last Edit: April 12, 2006, 04:50:11 PM by moerl » Logged
moerl
Charter Member
***
Posts: 404


View Profile Give some DonationCredits to this forum member
« Reply #24 on: April 12, 2006, 04:40:08 PM »

I saw SmartGUI Creator on the AHK download page. That sounds intriguing smiley
Logged
Pages: [1] 2 Next   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.643s | Server load: 0.08 ]