Simple Volume OSD

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
joedf
Posts: 8994
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Simple Volume OSD

01 Oct 2013, 17:37

Here is an example script of a nice Volume OSD script.
Scroll (on the taskbar) to try it out :D

Script:
Revision 3 - [r3]
Spoiler
Screenshots:
Spoiler
 
Cheers! :D
[wkr][/wkr]
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
huyaowen
Posts: 109
Joined: 28 Jul 2014, 01:15

Re: Simple Volume OSD

14 Sep 2014, 05:54

Volume changed scroll ANYWHERE.winxp
User avatar
xZomBie
Posts: 256
Joined: 02 Oct 2013, 02:57

Re: Simple Volume OSD

14 Sep 2014, 08:52

huyaowen wrote:Volume changed scroll ANYWHERE.winxp
I conform this situation. Win7 64bit.
User avatar
joedf
Posts: 8994
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Simple Volume OSD

14 Sep 2014, 15:23

Really!? It's an old script.. Ok I'll try to fix it soon..
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
joedf
Posts: 8994
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Simple Volume OSD

16 Sep 2014, 01:10

Whoops, sorry looks i set over_tray to '0'
I have updated the script with over_tray:=1 as default, luckily there was no bug ;)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
huyaowen
Posts: 109
Joined: 28 Jul 2014, 01:15

Re: Simple Volume OSD

16 Sep 2014, 02:28

nice
thanks
no mute.
User avatar
kczx3
Posts: 1649
Joined: 06 Oct 2015, 21:39

Re: Simple Volume OSD

04 Feb 2016, 15:53

This was something that I whipped up as my work PC didn't have a OSD for the volume like I was used to.

Code: Select all

;On-screen volume slider
SetFormat, Float, 0 ;No decimal places
SysGet, MonitorArea, MonitorWorkArea, 1
volLeft := MonitorAreaRight * .1
volTop := MonitorAreaBottom * .2
SoundGet, initVol, MASTER, VOLUME
SoundGet, Mute, MASTER, MUTE

;GUI for volume progress, is hidden initially and only shown when volUP, volDOWN, or volMUTE are pressed.
Gui, Color, 000000
Gui, Margin, 10 0
Gui, Font, s11 Bold Tahoma
Gui, -Caption +AlwaysOnTop +ToolWindow +LastFound
Gui, Add, Progress, w20 h125 Vertical Range0-100 vVolumeProgress, %initVol%
Gui, Add, Text, w20 x10 y70 Center BackgroundTrans vVolNumber, %initVol%
Gui, Add, Pic, x12 y140 w16 h-1 Icon1 vVolIcon, C:\Windows\System32\SndVol.exe
Gui, Show, w40 h165 x%volLeft% y%volTop% HIDE, Volume

;Makes the corners of the GUI rounded.  Needs to have H and W be the same as the GUI size.
WinSet, Region, 0-0 W40 H165 R10-10
Return

;Hotkeys
Volume_Down::VolumeDown()
Volume_Up::VolumeUp()
Volume_Mute::VolumeMute()

;Functions
VolumeUp()
{
	SoundGet, Mute, MASTER, MUTE
	If (Mute = "ON")
		SoundSet, OFF, MASTER, MUTE
	SoundSet, +2, MASTER, VOLUME
	ShowVolumeControl()
}
 
VolumeDown()
{
	SoundGet, Mute, MASTER, MUTE
	If (Mute = "ON")
		SoundSet, OFF, MASTER, MUTE
	SoundSet, -2, MASTER, VOLUME
	ShowVolumeControl()
}

VolumeMute()
{
	SoundSet, -1, MASTER, MUTE
	ShowVolumeControl()
}

;Function to adjust the GUI. No sound settings are adjusted in this function.
ShowVolumeControl()
{
	SoundGet, newVol, MASTER, VOLUME
	SoundGet, Mute, Master, MUTE
	
	;If the mute button was depressed, update progress to 0 and show mute icon.
	;REMEMBER - we aren't actually setting the sound volume to 0.
	If (Mute = "ON")
	{
		GuiControl, , VolIcon, *w16 *h-1 *Icon3 C:\Windows\System32\SndVol.exe
		GuiControl, , VolumeProgress, 0
		GuiControl, , VolNumber, - -
	}
	;Set progress to volume level and update icon
	;We update the icon in case the sound was muted when the -/+ was hit.
	Else
	{
		GuiControl, , VolIcon, *w16 *h-1 *Icon2 C:\Windows\System32\SndVol.exe
		GuiControl, , VolumeProgress, %newVol%
		GuiControl, , VolNumber, %newVol%
	}
 
	; Setup timer to hide gui after 3 second
	Gui, Show
	SetTimer, HideVolumeBar, -3000
	Return
 
	; Hide progress bar
HideVolumeBar:
	Gui, Hide
	Return
}
Return
User avatar
joedf
Posts: 8994
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Simple Volume OSD

04 Feb 2016, 19:44

Very nice, actually! :)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
BGM
Posts: 507
Joined: 20 Nov 2013, 20:56
Contact:

Re: Simple Volume OSD

04 Feb 2016, 20:53

Neat! If I wasn't using 7TT (7+Taskbar Tweaker) I would use this script.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 27 guests