AutoHotkey Community

It is currently May 27th, 2012, 5:56 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 151 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10, 11  Next
Author Message
 Post subject:
PostPosted: July 17th, 2010, 12:07 pm 
Offline

Joined: April 2nd, 2010, 12:46 pm
Posts: 24
Quote:
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.

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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2010, 1:44 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
TBM_GETPOS and TBM_SETPOSNOTIFY seem to work.
Code:
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 *-1
You may need to use WinGet List and possibly ControlGetPos/ControlGetText to determine which slider to move.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 18th, 2010, 3:46 am 
Offline

Joined: April 2nd, 2010, 12:46 pm
Posts: 24
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.

Code:
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
      }
   }
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2010, 4:05 pm 
Offline

Joined: June 15th, 2010, 6:48 pm
Posts: 13
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 20th, 2010, 11:03 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Ivan68 wrote:
Is there any kind of function as:

On event (peak=1.00)
gosub....
No. Use a timer or loop which repeatedly checks the peak value.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 6th, 2010, 7:45 am 
Offline

Joined: February 7th, 2009, 5:37 am
Posts: 43
Lexikos
Can you please update this library to make it compatible with AHK_L x64?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 16th, 2010, 5:56 am 
Offline

Joined: July 15th, 2006, 1:30 am
Posts: 48
Big Digger wrote:
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.

_________________
One hotkey to rule them all!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 16th, 2010, 2:50 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
Updated. v2.1 requires AutoHotkey_L but does not require COM.ahk.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 16th, 2010, 3:56 pm 
Offline

Joined: February 7th, 2009, 5:37 am
Posts: 43
Lexikos thank you very much!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 19th, 2010, 6:10 am 
Offline

Joined: July 15th, 2006, 1:30 am
Posts: 48
Lexikos wrote:
Updated. v2.1 requires AutoHotkey_L but does not require COM.ahk.


Much appreciated. :D

_________________
One hotkey to rule them all!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 17th, 2010, 8:24 pm 
Lexikos wrote:
Updated. v2.1 requires AutoHotkey_L but does not require COM.ahk.


Thank you so much!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 2nd, 2010, 3: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:

Code:
#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!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 2nd, 2010, 7:06 pm 
Anonymous wrote:
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:

Code:
#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!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 9th, 2010, 2:00 am 
Offline

Joined: September 6th, 2009, 6:56 pm
Posts: 32
Anonymous wrote:
Anonymous wrote:
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:

Code:
#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


Report this post
Top
 Profile  
Reply with quote  
PostPosted: December 23rd, 2010, 4:50 am 
Offline

Joined: December 23rd, 2010, 1:42 am
Posts: 8
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 ...


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 151 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10, 11  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Apollo, Bing [Bot], Exabot [Bot], Google Feedfetcher, JamixZol, rbrtryn and 20 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group