Thanks for looking into it. Seems like the only solution right now is to move the sliders in the Win mixer. I could do this in AHK with a mouse macro, but that's a bit cheesy. If someone knows how to send window messages to the Win7 audio mixer, please let me know.After spending several hours researching it, wrapping various COM interfaces and experimenting I'm able to enumerate audio sessions and determine which app owns them, but not control their volume.
Vista Audio Control Functions
Started by
Lexikos
, Oct 02 2007 12:47 PM
182 replies to this topic
#106
-
Posted 17 July 2010 - 11:07 AM
TBM_GETPOS and TBM_SETPOSNOTIFY seem to work.
SendMessage TBM_GETPOS:=0x400,,, msctls_trackbar321, Volume Mixer v := ErrorLevel - 5 ; Note range is 0-100, but reversed. SendMessage TBM_SETPOSNOTIFY:=0x422, 1, v, msctls_trackbar321, Volume Mixer SoundPlay *-1You may need to use WinGet List and possibly ControlGetPos/ControlGetText to determine which slider to move.
#107
-
Posted 17 July 2010 - 12:44 PM
Thanks for the message codes. I put together a function that takes the name of the app, the desired vol. level, and sets the relevant volume slider. Identifying the slider by app name is a bit hacky. It relies on the hor. distance from the text label control. This may need tweaking for your DPI/font settings, but it works for me.
SetTitleMatchMode 2 ; Name of the app you want to control appName = System Sounds ; Volume level you want newVal = 50 ; 0-100 Run sndvol ; launch Win sound mixer WinWait Volume Mixer SetVal(appName, newVal) WinClose Volume Mixer ; close the mixer SetVal(appName, newVal) { ; the slider IDs seem to start at 321 startIDX = 321 ; the app slider is identified by hor. distance from its text label ; maxDiff below sets the maximum allowed distance ; On my system, with my DPI and fonts, the reported distance is 36 maxDiff = 40 ControlGetPos, refX, , , , % appName, Volume Mixer x = 1 while ( x != "") { tbIDX := startIDX + A_Index - 1 ControlGetPos, x, , , , msctls_trackbar%tbIDX%, Volume Mixer diff := Abs(x-refX) if (diff < maxDiff && diff != "") { ; msgbox diff: %diff% refX: %refX% tbIDX: %tbIDX% x: %x% ; SendMessage TBM_GETPOS:=0x400,,, msctls_trackbar%tbIDX%, Volume Mixer v := 100 - newVal ; Note range is 0-100, but reversed. SendMessage TBM_SETPOSNOTIFY:=0x422, 1, v, msctls_trackbar%tbIDX%, Volume Mixer break } } }
#108
-
Posted 18 July 2010 - 02:46 AM
It looks working properly now. Many thanks Lexikos, great!
My goal is quite odd. I would like to connect a simple on/off switch to the mic plug and wait for getting it pressed.
Is there any kind of function as:
On event (peak=1.00)
gosub....
Thanks again
Ivan
My goal is quite odd. I would like to connect a simple on/off switch to the mic plug and wait for getting it pressed.
Is there any kind of function as:
On event (peak=1.00)
gosub....
Thanks again
Ivan
#109
-
Posted 20 July 2010 - 03:05 PM
No. Use a timer or loop which repeatedly checks the peak value.Is there any kind of function as:
On event (peak=1.00)
gosub....
#110
-
Posted 20 July 2010 - 10:03 PM
Lexikos
Can you please update this library to make it compatible with AHK_L x64?
Can you please update this library to make it compatible with AHK_L x64?
#111
-
Posted 06 September 2010 - 06:45 AM
Lexikos
Can you please update this library to make it compatible with AHK_L x64?
Indeed, this library is very helpfull but won't work with Autohotkey_L x64 Unicode.
#112
-
Posted 16 September 2010 - 04:56 AM
One hotkey to rule them all!
Updated. v2.1 requires AutoHotkey_L but does not require COM.ahk.
#113
-
Posted 16 September 2010 - 01:50 PM
Updated. v2.1 requires AutoHotkey_L but does not require COM.ahk.
Much appreciated.
#115
-
Posted 19 September 2010 - 05:10 AM
One hotkey to rule them all!
Updated. v2.1 requires AutoHotkey_L but does not require COM.ahk.
Thank you so much!
#116
-
Posted 17 October 2010 - 07:24 PM
hi!
sorry if this is to basic
but I just want to have a script that when you press "win"+"v" mute the sound of my computer running windows 7
I try with this script:
the error I get is that VA doesn't exit
I copied the VA.ahk to the /lib/ directory under autohokey main path
any help wil be really appreciated
thanks!
sorry if this is to basic
but I just want to have a script that when you press "win"+"v" mute the sound of my computer running windows 7
I try with this script:
#v:: VA_SetMasterVolume(0) return
the error I get is that VA doesn't exit
I copied the VA.ahk to the /lib/ directory under autohokey main path
any help wil be really appreciated
thanks!
#117
-
Posted 02 December 2010 - 02:45 PM
hi!
sorry if this is to basic
but I just want to have a script that when you press "win"+"v" mute the sound of my computer running windows 7
I try with this script:#v:: VA_SetMasterVolume(0) return
the error I get is that VA doesn't exit
I copied the VA.ahk to the /lib/ directory under autohokey main path
any help wil be really appreciated
thanks!
probelm solve
thanks anyway!
#118
-
Posted 02 December 2010 - 06:06 PM
hi!
sorry if this is to basic
but I just want to have a script that when you press "win"+"v" mute the sound of my computer running windows 7
I try with this script:#v:: VA_SetMasterVolume(0) return
the error I get is that VA doesn't exit
I copied the VA.ahk to the /lib/ directory under autohokey main path
any help wil be really appreciated
thanks!
probelm solve
thanks anyway!
As Solved ..? I have the same error with the VA pliss help
#119
-
Posted 09 December 2010 - 01:00 AM
I'm a total noob. I installed Autohotkey_L and extracted the VA.ahk to the same directory where autohotkey.exe is located. I right click on topology.ahk and immediately get the error message in the subject above. Apparently I'm missing something ...
#120
-
Posted 23 December 2010 - 03:50 AM