Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Volume control (with small GUI)


  • Please log in to reply
12 replies to this topic
Dactilus
  • Members
  • 3 posts
  • Last active: Jun 10 2010 08:42 AM
  • Joined: 29 Nov 2005
Change Master and Wave volume at same time.
Tested on WinXP.

Note: Mic checked says "Active", not "Mute" , and is changed via hotkey.

Posted Image Posted Image
;#NoTrayIcon 

#Up:: 
SoundSet +1
SoundSet, +1, wave
gosub, vupdt
return

#Down:: 
SoundSet -1
SoundSet, -1, wave
gosub, vupdt
return

#Left:: 
SoundSet, -0, Microphone, mute
IfWinExist, volume
{
SoundGet, m_m, Microphone, mute
if m_m = On
GuiControl,, R, 0 
else
GuiControl,, R, 1
SetTimer,label, 2000
return
}
Gosub, show
Return 

#Right:: 
SoundSet, -0, MASTER, mute
IfWinExist, volume
{
SoundGet, v_m, master, mute
if v_m = On
GuiControl,, Pic1,*icon40 C:\WINDOWS\system32\mmsys.cpl
else 
GuiControl,, Pic1, *icon1 C:\WINDOWS\system32\mmsys.cpl
SetTimer,label, 2000
return
}
Gosub, show 
Return 
;This routine is isolated to avoid icon flashing
vupdt:
IfWinExist, volume
{
SoundGet, master_volume
GuiControl,, MP, %master_volume%
SetTimer,label, 2000
return
}
Gosub, show 
Return 

show:
SoundGet, master_volume
SoundGet, m_m, Microphone, mute
SoundGet, v_m, master, mute

IfWinNotExist, volume
{
Gui, +ToolWindow -Caption +0x400000 +alwaysontop
Gui, Add, GroupBox, x3 y12 w40 h45 cblack,
Gui, Add, GroupBox, x3 y60 w40 h35 cblack, Mic:
Gui, Add, text, x10 y1 ,Volume:
Gui, Add, Progress,vertical vMP x45 y18 w13 h77 c333cc,%master_volume%
Gui, Add, checkbox, vR x16 y75 w15 h15 cblue,
if v_m = On
Gui, Add, pic, x7 y22 vPic1 icon40, C:\WINDOWS\system32\mmsys.cpl
else
Gui, Add, pic, x7 y22 vPic1 icon1, C:\WINDOWS\system32\mmsys.cpl
if m_m = On
GuiControl,, R, 0 
else
GuiControl,, R, 1
Gui, Show, NoActivate x720 y460 h100 w60, volume
}
SetTimer,label, 2000
return

label:
SetTimer,label, off
Gui, destroy


Gennadiy
  • Guests
  • Last active:
  • Joined: --
Beautiful!! :!: :)

garath
  • Members
  • 398 posts
  • Last active: Feb 05 2011 10:31 PM
  • Joined: 24 Mar 2005
You should use
%A_WinDir%\system32\mmsys.cpl
instead of
C:\WINDOWS\system32\mmsys.cpl

I don't have a Drive C:-(

  • Guests
  • Last active:
  • Joined: --
this is cool. two thumbs up! 8)
tks Dactilus

badmojo
  • Members
  • 204 posts
  • Last active: Jul 23 2014 01:39 AM
  • Joined: 11 Nov 2005
this is simple but good. would come in very handy...:wink:

cracksloth
  • Guests
  • Last active:
  • Joined: --
i ran into a little problem modding this script to popup when mute status has changed. this particular need is pretty simple so i just added:

Volume_Mute::
SoundSet, +1, , mute
gosub, vupdt
return

this works great but the mute icon doesn't update when i quickly change mute status multiple times (in other words, when i press the mute hotkey again before the menu times out). i know this would only happen infrequently but it bothers me just because i know it exists. :) does anyone know of a way to fix this?

as a second note, does anyone know how to make the menu background transparent or remove it entirely? i only just started playing with autohotkey, does it show? :) any help would be appreciated!

toolazytothinkofanick
  • Members
  • 2 posts
  • Last active: Jan 20 2007 04:54 AM
  • Joined: 30 Oct 2006
; For transparency.

;#NoTrayIcon

#Up::
SoundSet +1
SoundSet, +1, wave
gosub, vupdt
return

#Down::
SoundSet -1
SoundSet, -1, wave
gosub, vupdt
return

#Left::
SoundSet, -0, Microphone, mute
IfWinExist, volume
{
SoundGet, m_m, Microphone, mute
if m_m = On
GuiControl,, R, 0
else
GuiControl,, R, 1
SetTimer,label, 2000
return
}
Gosub, show
Return

#Right::
SoundSet, -0, MASTER, mute
IfWinExist, volume
{
SoundGet, v_m, master, mute
if v_m = On
GuiControl,, Pic1,*icon40 C:\WINDOWS\system32\mmsys.cpl
else
GuiControl,, Pic1, *icon1 C:\WINDOWS\system32\mmsys.cpl
SetTimer,label, 2000
return
}
Gosub, show
Return
;This routine is isolated to avoid icon flashing
vupdt:
IfWinExist, volume
{
SoundGet, master_volume
GuiControl,, MP, %master_volume%
SetTimer,label, 2000
return
}
Gosub, show
Return

show:
SoundGet, master_volume
SoundGet, m_m, Microphone, mute
SoundGet, v_m, master, mute

IfWinNotExist, volume
{
Gui, Color, 000000       ; < -- added
Gui, +ToolWindow -Caption +0x400000 +alwaysontop
Gui, Add, GroupBox, x3 y12 w40 h45 cblack,
Gui, Add, GroupBox, x3 y60 w40 h35 cblack, Mic:
Gui, Add, text, x10 y1 ,Volume:
Gui, Add, Progress,vertical vMP x45 y18 w13 h77 c333cc,%master_volume%
Gui, Add, checkbox, vR x16 y75 w15 h15 cblue,
if v_m = On
Gui, Add, pic, x7 y22 vPic1 icon40, C:\WINDOWS\system32\mmsys.cpl
else
Gui, Add, pic, x7 y22 vPic1 icon1, C:\WINDOWS\system32\mmsys.cpl
if m_m = On
GuiControl,, R, 0
else
GuiControl,, R, 1
Gui, Show, NoActivate x720 y460 h100 w60, volume
Gui, +LastFound     ; < -- added
WinSet, TransColor, 000000    ; < -- added
}
SetTimer,label, 2000
return

label:
SetTimer,label, off
Gui, destroy

I finally decided to post ...
Posted Image

Yayayaya! 2 posts!

RedsockRock
  • Members
  • 4 posts
  • Last active: Nov 03 2006 04:40 AM
  • Joined: 02 Nov 2006
thank you

TheLeO
  • Members
  • 264 posts
  • Last active: Jan 02 2012 01:51 AM
  • Joined: 11 Jun 2005
For relative Positioning, ie so the osd comes up on the bottom right corner of the screen instead of in the middle:

replace

Gui, Show, NoActivate x720 y460 h100 w60, volume
(which can be found just before the end of the script.)

With:

;relative positioning
OsdVolPosX := A_ScreenWidth - 120 ;this and the below bit makes sure it works on every pc
OsdVolPosY := A_ScreenHeight - 174
Gui, Show, NoActivate x%OsdVolPosX% y%OsdVolPosY% h100 w60, volume

change the -XXX to adjust vertical and horizontal positioning if needed.

hope it's usefull.
::
I Have Spoken
::

Sukarn
  • Members
  • 35 posts
  • Last active: Aug 16 2007 06:08 PM
  • Joined: 16 Jun 2007

;relative positioning
OsdVolPosX := A_ScreenWidth - 120 ;this and the below bit makes sure it works on every pc
OsdVolPosY := A_ScreenHeight - 174
Gui, Show, NoActivate x%OsdVolPosX% y%OsdVolPosY% h100 w60, volume

change the -XXX to adjust vertical and horizontal positioning if needed.


I changed it a bit so that it comes up at the bottom right corner of my screen. I have the taskbar on the right side of my screen with auto-hide.
OsdVolPosX := A_ScreenWidth - 67
OsdVolPosY := A_ScreenHeight - 105
Gui, Show, NoActivate x%OsdVolPosX% y%OsdVolPosY% h100 w60, volume


sdf
  • Guests
  • Last active:
  • Joined: --
#WheelUp::

SoundSet +5

SoundSet, +5, wave

gosub, vupdt

return



#WheelDown::

SoundSet -5

SoundSet, -5, wave

gosub, vupdt

return



#XButton1::

SoundSet, -0, Microphone, mute

IfWinExist, volume

{

SoundGet, m_m, Microphone, mute

if m_m = On

GuiControl,, R, 0

else

GuiControl,, R, 1

SetTimer,label, 500

return

}

Gosub, show

Return



#XButton2::

SoundSet, -0, MASTER, mute

IfWinExist, volume

{

SoundGet, v_m, master, mute

if v_m = On

GuiControl,, Pic1,*icon40 C:\WINDOWS\system32\mmsys.cpl

else

GuiControl,, Pic1, *icon1 C:\WINDOWS\system32\mmsys.cpl

SetTimer,label, 500

return

}

Gosub, show

Return

;This routine is isolated to avoid icon flashing

vupdt:

IfWinExist, volume

{

SoundGet, master_volume

GuiControl,, MP, %master_volume%

SetTimer,label, 500

return

}

Gosub, show

Return



show:

SoundGet, master_volume

SoundGet, m_m, Microphone, mute

SoundGet, v_m, master, mute



IfWinNotExist, volume

{

CustomColor = black ; Can be any RGB color (it will be made transparent below).
Gui +LastFound +AlwaysOnTop -Caption +ToolWindow
Gui, Color, %CustomColor%
WinSet, TransColor, %CustomColor% 200
Gui, Add, GroupBox, x3 y12 w40 h45 cblack,

Gui, Add, GroupBox, x3 y60 w40 h35 cLime, Mic:

;Gui, Add, text, x10 y1 ,Volume:

Gui, Add, Progress,vertical vMP x45 y18 w13 h77 cRed Background%CustomColor%,%master_volume%

Gui, Add, checkbox, vR x16 y75 w15 h15 cBlue,

if v_m = On

Gui, Add, pic, x7 y22 vPic1 icon40 -Background, C:\WINDOWS\system32\mmsys.cpl

else

Gui, Add, pic, x7 y22 vPic1 icon1, C:\WINDOWS\system32\mmsys.cpl

if m_m = On

GuiControl,, R, 0

else

GuiControl,, R, 1

OsdVolPosX := A_ScreenWidth - 67
OsdVolPosY := A_ScreenHeight - 135
Gui, Show, NoActivate x%OsdVolPosX% y%OsdVolPosY% h100 w60, volume

}

SetTimer,label, 500

return



label:

SetTimer,label, off

Gui, destroy

nilsonrdg
  • Members
  • 31 posts
  • Last active: Jul 06 2014 04:02 PM
  • Joined: 27 Mar 2010
 
I really appreciated that script. I just changed the hotkeys to be more practical to control the volume. I suggest the use of:
 
^Numpadadd:: 
 
^Numpadsub:: 
 
^numpadenter:: 
 
and
 
^Numpaddot:: 
 
 


nilsonrdg
  • Members
  • 31 posts
  • Last active: Jul 06 2014 04:02 PM
  • Joined: 27 Mar 2010
Why ^Numpadadd, ^Numpadsub, ^numpadenter, ^Numpaddot ? 
 
These hotkeys allow me to control the volume using the thumb, without letting go of the mouse. And the "control key" is in the extremity of the keyboard (more easy to use).