Jump to content

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

Simple script with GUI for setting the sound volume


  • Please log in to reply
4 replies to this topic
Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
Volume setting can be done with the Windows SndVol32 program, which has its own GUI. Its icon is in the tray by default, but it uses up space (Win 2k) and takes time to find it with the mouse. After assigning it to HotKeys, the icon can be removed, or kept for accessing advanced settings.

Win-Up and Win-Down starts SndVol32, with its GUI in the middle of the screen. Win-Up increases the sound volume by 5%, Win-Down decreases it. PgUp and PgDn make 20% change. The cursor Up and Right keys increase the volume by 1%, repeatedly, until they are kept pressed. The cursor Down and Left keys decrease the volume by 1%. The Home key sets the volume to maximum, the End key to minimum. All these keys also sound a beep, to let you know the actual volume setting.

At start of the script the muse cursor is positioned on the graphic slider, allowing fine settings with grabbing it. The muse wheel can be used also for adjusting the volume.

The key M toggles Muting. Other keys just emit beeps, helping evaluating the volume setting.

Activating another window (with Alt-TAB or mouse-click) or Alt-F4 saves the volume setting and closes the program. All these with 15 lines of AHK script!
CoordMode Mouse, Screen

#Up::
#Down::
CX := A_ScreenWidth  / 2 - 50
CY := A_ScreenHeight / 2 - 80
MouseMove CX, CY, 0
Run sndvol32 /tray
IfEqual A_ThisHotKey,#UP, SoundSet +5
else SoundSet -5
SoundPlay *-1
SoundGet V
Y := 118 - 0.7*V
WinWait Master Volume
MouseMove 48, Y, 0, R
return


daonlyfreez
  • Members
  • 995 posts
  • Last active: Jan 23 2013 08:16 AM
  • Joined: 16 Mar 2005
8) My compliments, works like a charm (it doesn't beep though, but I don't need that anyway :p )
Posted Image mirror 1mirror 2mirror 3ahk4.me • PM or Posted Image

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
Thanks! It should beep, though. Have you installed the Windows standard sound effects? In Windows 2000 the sound files are in WINNT/MEDIA, and the beep is ding.wav. Another possibility is that the WAVE output of your soundcard is muted or on very low volume. This script changes the master volume, and does not affect the relative strength of synthesized music or CD or wave output. Double clicking on the speaker icon in the tray (or typing SndVol32 in the command prompt) opens the full version of the Master Volume tool, where you can see if the WAVE slider is low or the WAVE output is muted.

daonlyfreez
  • Members
  • 995 posts
  • Last active: Jan 23 2013 08:16 AM
  • Joined: 16 Mar 2005
Sec, my bad :p I tend to get overexited :shock: ... :p ... I had my alerts set off :D ...

Funny, it works with a freeware utility I use called 'Tray Wizard' too! (Direct download here 8) )

I use it to keep my tray from cluttering (it hides my sound-control icon for example :p ) and it has some nice extras...

Posted Image
Posted Image mirror 1mirror 2mirror 3ahk4.me • PM or Posted Image

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
Thanks for the link! It is not surprising that the script works with a tray management utility, because it runs the program sndvol32 with its /tray option, not accessing the tray directly.