Jump to content


Photo

Windows 7 - Volume Control OSD v1.10


  • Please log in to reply
28 replies to this topic

#1 em02044

em02044
  • Members
  • 19 posts

Posted 19 November 2010 - 12:51 AM

Volume Control v1.10

This is a simple volume control with "on screen display" for windows 7. It now supports windows messages (a very useful function so other scripts like for example "Lex Mouse Gestures" can control it).

Posted Image

How to use:
Hold down mouse middle button for 0,5 seconds to display "Volume Control".
- Mouse Wheel Up -> Increase Volume
- Mouse Wheel Down -> Decrease Volume
- Mouse Middle Button -> Mute/Unmute
- Mouse Left click on the bar -> Sets the volume to the clicked position
- Mouse Left click on the speaker -> Mute/Unmute

(AutoHotkey_L is needed)

DOWNLOAD

Volume Control Change Log:
v1.10 (13/12/2010)
- Controlled by windows messages
- Specific volume increment for mouse wheel gesture
- Returns WMP to full screen (not 100% reliable!, still needs more work)

#2 x79animal

x79animal
  • Members
  • 1021 posts

Posted 20 November 2010 - 02:23 AM

VA.ahk contains lots and lots of functions, did you make it or is it a library you got from somewhere else?

anyway this is really really good. Thanks alot for sharing =]

#3 em02044

em02044
  • Members
  • 19 posts

Posted 20 November 2010 - 09:46 AM

VA.ahk is Vista Audio Control Functions v2.1 and I have downloaded from here. I know that VA.ahk has lots of funtions but for now I only needed my volume OSD to Increase/Deacrease/Mute/Unmute the system master volume.

Its good to know that you liked it.

#4 KarmicSquirrel

KarmicSquirrel
  • Members
  • 8 posts

Posted 21 November 2010 - 09:14 PM

I get an include error when running the .ahk

Posted Image

#5 fincs

fincs
  • Fellows
  • 1530 posts

Posted 21 November 2010 - 09:19 PM

You need AutoHotkey_L.

#6 em02044

em02044
  • Members
  • 19 posts

Posted 16 December 2010 - 02:46 PM

Newer version is now available!!

#7 bj

bj
  • Members
  • 5 posts

Posted 16 December 2010 - 05:39 PM

Now that's the coolest volume control ever!! Thank you.

#8 Jamin3D

Jamin3D
  • Guests

Posted 02 January 2011 - 12:50 AM

I have AutoHotkey_L installed. When I run Volume Control.ahk, I get an error: Call to nonexistent function. Specifically: VA_GetMasterVolume()

Any ideas?

#9 Jamin3D

Jamin3D
  • Guests

Posted 02 January 2011 - 12:57 AM

Ok, got it-- I was apparently trying to run it from inside the zip file.

Now I just need to adapt this to work on the laptop... no middle-mouse button and no scroll-wheel...

#10 Pio

Pio
  • Members
  • 19 posts

Posted 25 January 2011 - 09:14 PM

Thanks for the great looking OSD! I tried to adapt to my needs (using a second bar for Subwoofer volume) but I disliked the "stealing focus" and thus minimize mediaplayer, youtube etc. So I tried to go around and after some time (and help in the German forum) I came up with this:
;Volume Control v1.10 for Windows7
;by Filipe Novais

;====================================================================================================================
;Options ============================================================================================================
;====================================================================================================================
Volume_Increments_general = 2		;Volume increments for keyboard default "Vol+" "Vol-" keys
Volume_Increments_mouse = 3		;Volume increments for mouse wheel gestures "up" "down"
Visible_Duration = 1800			;Duration of Volume Control display (milliseconds)



;====================================================================================================================
;Startup ============================================================================================================
;====================================================================================================================
#Include *i VA.ahk
Volume_Increments = %Volume_Increments_general%
OnMessage(0x1001,"VC_ReceiveMessage")
	Gui 29: show, hide, Volume Control - message receiver
Menu, Tray, Icon, Shell32.dll, 169 				; Square Speaker Icon
;Menu, Tray, Icon, %SystemRoot%\system32\Mmsys.cpl,1   	 	; Standard Speaker Icon



;====================================================================================================================
;Volume OSD Background ==============================================================================================
;====================================================================================================================
Gui, 27: +AlwaysOnTop +ToolWindow -caption +LastFound
WinSet, Region, 0-0 W602 H59
Gui, 27: Color, FFFF00
Gui, 27: Add, Picture, w602 h59 x0 y0, %A_ScriptDir%\Pictures\Background.png
WinSet, TransColor, FFFF00 255



;====================================================================================================================
;Volume OSD Bars and Speakers =======================================================================================
;====================================================================================================================
Gui, 28: +AlwaysOnTop +ToolWindow -caption +LastFound
WinSet, Region, 0-0 W602 H59
Gui, 28: Color, FFFF00
WinSet, TransColor, FFFF00 255
Gui, 28: Add, Picture, w81 h59 x0 y0 gMute_On_Off vMuteOff, %A_ScriptDir%\Pictures\SpeakerSound.png
Gui, 28: Add, Picture, w81 h59 x0 y0 gMute_On_Off vMuteOn, %A_ScriptDir%\Pictures\SpeakerMute.png
startp = 83
Loop 100
	{
	Gui, 28: Add, Picture, vBF%A_Index% w5 h29 x%startp% y15 gVolume_Bar_Click, %A_ScriptDir%\Pictures\Full.png
	Gui, 28: Add, Picture, vBE%A_Index% w5 h29 x%startp% y15 gVolume_Bar_Click, %A_ScriptDir%\Pictures\Empty.png
	startp += 5
	}
return


;====================================================================================================================
;Hotkeys ============================================================================================================
;====================================================================================================================

						
$Volume_Up::					;Keyboard default "Vol+" key
Gosub, Up_Volume 
return

$Volume_down::					;Keyboard default "Vol-" key
Gosub, Down_Volume
return

$Volume_Mute::					;Keyboard default Mute/Unmute key
Gosub, Mute_On_Off
return


;====================================================================================================================
;Labels =============================================================================================================
;====================================================================================================================


Up_Volume:
volume_level := VA_GetMasterVolume()
volume_level += %Volume_Increments%
VA_SetMasterVolume(volume_level)
Gosub, Volume_Bar_Update
return


Down_Volume:
volume_level := VA_GetMasterVolume()
volume_level -= %Volume_Increments%
VA_SetMasterVolume(volume_level)
Gosub, Volume_Bar_Update
return


Volume_Bar_Update:
If WinActive("FullScreenBottomLayout")
fullscreen=1
volume_level := VA_GetMasterVolume()
SetTimer, Volume_Bar_Hide, off
Loop %volume_level%
	{
	GuiControl,28: Hide, BE%A_Index%
	GuiCOntrol,28: Show, BF%A_Index%
	}
volume_level2 := 100 - volume_level
Loop %volume_level2%
	{
	index := 101 - A_Index
	GuiCOntrol,28: Hide, BF%index%
	GuiControl,28: Show, BE%index%
	}
Volume_Bar_Update2:
if VA_GetMasterMute()
	{
	GuiControl,28: Show, MuteOn
	GuiCOntrol,28: Hide, MuteOff
	}
else
	{
	GuiControl,28: Show, MuteOff
	GuiCOntrol,28: Hide, MuteOn
	}
gosub, Show_Background
Gui, 28: +AlwaysOnTop
Gui, 28: Show, xCenter yCenter w602 h95 NoActivate
SetTimer, Volume_Bar_Hide, %Visible_Duration%
return


Volume_Bar_Hide:
SetTimer, Volume_Bar_Hide, off
Gui, 28: Hide
Gui, 27: Hide
Background_Vis=0
if fullscreen=1
	{
	sleep 300
	fullscreen=0
	;WinActivate, Windows Media Player
	;send, !{ENTER}
	}
return


Show_Background:
If %Background_Vis%
return
Gui, 27: +AlwaysOnTop
Gui, 27: Show, xCenter yCenter w602 h95 NoActivate
Background_Vis=1
return


Volume_Bar_Click:
Gui_Bar_To_Volume=% A_GuiControl
StringTrimLeft, volume_level, Gui_Bar_To_Volume, 2
VA_SetMasterVolume(volume_level)
Gosub, Volume_Bar_Update
return


Mute_On_Off:
if VA_GetMasterMute()
	{
	VA_SetMasterMute(false)
	Gosub, Volume_Bar_Update2
	}
else
	{
	VA_SetMasterMute(true)
	Gosub, Volume_Bar_Update2
	}
return


Volume_Mouse_on:
Volume_Increments = %Volume_Increments_mouse%
return


Volume_Mouse_off:
Volume_Increments = %Volume_Increments_general%
return


;====================================================================================================================
;Messages ===========================================================================================================
;====================================================================================================================


VC_ReceiveMessage(Message) 
	{
	if Message = 01				; Volume increase with mouse wheel gesture
		{
		Gosub, Volume_Mouse_on
		Gosub, Up_Volume
		Gosub, Volume_Mouse_off
		return
		}

	else if Message = 02			; Volume decrease with mouse wheel gesture
		{
		Gosub, Volume_Mouse_on
		Gosub, Down_Volume
		Gosub, Volume_Mouse_off
		return
		}

	else if Message = 03    		; Mute/Unmute
		Gosub, Mute_On_Off

	else if Message = 04    		; show Volume Control
		Gosub, Volume_Bar_Update

	else if Message = 05     		; Volume Control Reload script   
		Reload
	}
return


;====================================================================================================================
;====================================================================================================================
;================================================== Control Example =================================================
;====================================================================================================================
;====================================================================================================================


MButton::
If WinActive("Volume Control.ahk")
	{
	PostMessage("Volume Control - message receiver",03)
	return
	}
StartTime := A_TickCount
KeyWait, MButton
if (A_TickCount - StartTime < 500)
	{
	MouseGetPos, xpos, ypos
	MouseClick, Middle,  xpos, ypos
	return
	}
else
	{
	PostMessage("Volume Control - message receiver",04)
	return
	}
return


wheelup::
If WinActive("Volume Control.ahk")
	{
	PostMessage("Volume Control - message receiver",01)
	return
	}
send {wheelup}
return 


wheeldown::  
If WinActive("Volume Control.ahk")
	{
	PostMessage("Volume Control - message receiver",02)
	return
	}
send {wheelDown}
return


PostMessage(Receiver,Message) {
	oldTMM := A_TitleMatchMode
	oldDHW := A_DetectHiddenWindows
	SetTitleMatchMode, 3
	DetectHiddenWindows, on
	PostMessage, 0x1001,%Message%,,,%Receiver% ahk_class AutoHotkeyGUI
	SetTitleMatchMode, %oldTMM%
	DetectHiddenWindows, %oldDHW%
}
return
New is the NoActivate but therefore the gui had to be made on top before showing it. It is even clickable, the only downside I can see so far is that the Mouse Wheel up/down doesn't work anymore. But if you can use the Mouse wheel, you should also be able to click on the specified position. Maybe this can be done in another way, I don't know. I hope you like it ;)

Thanks again for the OSD,
Pio

#11 Carrozza

Carrozza
  • Members
  • 199 posts

Posted 26 January 2011 - 08:01 AM

Em02044, congratulations for this nice script!

#12 Pio

Pio
  • Members
  • 19 posts

Posted 28 January 2011 - 03:38 PM

As I'm buidlung my own OSD at the moment and I encountered a similar problem to yours: You can easily get rid of the long loading time by using bitmaps instead of png. Before it's completely loaded, the OSD doesn't behave like it should. Instead of 8Seconds ony my rig (QuadCore, 3Ghz), it takes now less then 1 second.

#13 Guests

  • Guests

Posted 05 June 2011 - 02:15 PM

Thank you very much this was exactly what I was looking for!

#14 wheeljack

wheeljack
  • Guests

Posted 08 July 2011 - 02:59 PM

Great script, thanks for this.

#15 Xx7

Xx7
  • Members
  • 614 posts

Posted 06 August 2011 - 06:03 PM

Having trouble with this. I don't have a middle button? Can it be change to a left mouse button.