You are here

Volume Hotkey Control

19 posts / 0 new
Last post
Devo
Offline
Last seen: 4 months 2 weeks ago
Joined: 2007-09-04 14:55
Volume Hotkey Control

I'm sorry that I don't have an actual app to request, just an idea for one. I tend to change the volume on my computer a lot and hate having to click on the icon to bring up the slider.

I was thinking it would be a good idea to have an app that sets hotkeys to change the Master Volume on the computer. Something like Ctrl+Shift+Up to increase the volume and Ctrl+Shift+Down to decrease the volume and maybe Ctrl+Shift+0 to mute. I know this could conflict with other hotkeys, but it is just an idea.

If anybody feels like creating a program for this or if anybody knows of a portable program that already does this, please let me know.

ZachHudock
ZachHudock's picture
Offline
Last seen: 4 years 7 months ago
Developer
Joined: 2006-12-06 18:07
This could be pretty easily

This could be pretty easily done with AutoHotkey, I think. I don't have the time to create the script, but if you are willing to learn a scripting language, AHK is fairly easy, and i'm guessing a script for the functionality you want won't be more than 15 to 20 lines of code, more likely it will be around 10.

The developer formerly known as ZGitRDun8705

Devo
Offline
Last seen: 4 months 2 weeks ago
Joined: 2007-09-04 14:55
Maybe

I've never used it, but I was thinking about a little more functionality to give it more options. Maybe have a user interface to allow for the setting of different hotkeys and to allow the hotkeys to control the different parts of the volume control (ie, Master Volume, Wave, SW Synth, CD Player, and Line Volume). This is a bit outside of my abilities considering they are non-existant. I'm hoping that somebody here will pick up this project.

ZachHudock
ZachHudock's picture
Offline
Last seen: 4 years 7 months ago
Developer
Joined: 2006-12-06 18:07
Just give it a shot, starting

Just give it a shot, starting with the basic functionality that you requested (hotkeys to control master volume, no UI). You could have a decent script cooked up after 20 minutes or so if you read the help file and look at some examples. Then keep improving from that basic state.

Edit: If you download AutoHotkey, open the help file and search for "volume" There will be a sample script called Volume On Screen Display by a person with the user name Rajat that the help file links to. It should be what you are looking for, or at least a good starting point. Also, look at the SoundSet command in the help file, it lists a couple examples there too.

The developer formerly known as ZGitRDun8705

Devo
Offline
Last seen: 4 months 2 weeks ago
Joined: 2007-09-04 14:55
I'll try it out, thanks.

I'll try it out, thanks.

OliverK
OliverK's picture
Offline
Last seen: 1 year 1 month ago
Developer
Joined: 2007-03-27 15:21
There's one in the script

There's one in the script showcase for ahk

Too many lonely hearts in the real world
Too many bridges you can burn
Too many tables you can't turn
Don't wanna live my life in the real world

dmg
Offline
Last seen: 9 years 10 months ago
Joined: 2006-08-11 01:14
I realize this is a dead topic

But I made a volume script and thought it might help someone.

#noenv
#singleinstance, ignore

#wheelup::
#up::
 {
   soundset, +5, master, vol, 1
   soundget, vol, master, vol, 1
   vol:= round(vol, 0)
   traytip, Volume, %vol%`%, , 17
   settimer, removetip, -1500, 0
 }
return

#wheeldown::
#down::
 {
   soundset, -5, master, vol, 1
   SoundGet, vol, master, vol, 1
   vol:= round(vol, 0)
   traytip, Volume, %vol%`%, , 17
   settimer, removetip, -1500, 0
 }
return

#mbutton::
#left::
 {
   soundset, +1, master, mute, 1
   SoundGet, mute, master, mute, 1
   settimer, removetip, -1500, 0
   
   if mute=on
    {
      traytip, Volume, Mute is On, , 19
    }
    
   else
    {
      traytip, Volume, Mute is Off, , 17
    }
 }
return

removetip:
 {
   traytip
 }
return

The only advantage this has over the script further down the page is that you can control how long the traytip sticks around. Thanks to chezduong for the idea to use the mouse wheel.

"My dear Mr Gyrth, I am never more serious than when I am joking."
~Albert Campion

wraithdu
Offline
Last seen: 9 years 1 month ago
Developer
Joined: 2007-06-27 20:22
AHK is an option, and so is

AHK is an option, and so is AutoIt. But I don't know about Vista. So far all solutions I've found are XP only. The Vista mixer is all kinds of weird Wink

dragonmage
Offline
Last seen: 9 years 7 months ago
Joined: 2007-01-15 02:25
Hotkeyz

This app claims to be portable http://www.skynergy.com/hotkeyz.html
I haven't checked to see if it leaves anything behind though.
It does sound like what you are looking for.

chezduong
Offline
Last seen: 1 week 6 days ago
Joined: 2006-12-06 04:01
1. Download AutoHotkey

1. Download AutoHotkey
2. Install to C:\ or extract the file AutoHotkey.exe onto your flash drive
3. Create a file called AutoHotkey.ini and paste the below inside the file
4. Run AutoHotkey.exe (it is already portable)
5. WIN+PageUP increases volume (or WIN+mousewheelup)
6. WIN+PageDOWN decreases volume (or WIN+mousewheeldown)
7. WIN+End toggles mute (or WIN+mousewheelclick)

You can compile this into an application with it's own icon by reading AHK documentation.

No hotkey conflict as far as I know. Enjoy.

; ___Master Volume Hotkeys_________________________________________________
#WheelUp::
#PGUP::
SoundSet, +1				; + Master volume
GoSub, Display
Return

#WheelDown::
#PGDN::
SoundSet, -1				; - Master volume
GoSub, Display
Return

#MButton::
#END::
Send {Volume_Mute}			; Mute/Unmute Master vol
GoSub, Display
Return

Display:
SoundGet,Level,
Level := Round(Level*1,0)
SoundGet,Mute,,Mute
If Mute=On
	Traytip, Master Volume, Master Volume is at %Level%`%.,,19
	Else Traytip, Master Volume, Master Volume is at %Level%`%.,,17
Return

[Changed code tags to pre, moderator SL]

Devo
Offline
Last seen: 4 months 2 weeks ago
Joined: 2007-09-04 14:55
A Little Help Please

I've been reading the help file for AutoHotkey to try to figure things out. What you've posted works like a charm, but I haven't been able to reduce the time that the TrayTip appears. I've tried adding

Traytip, Master Volume, Master Volume is at %Level%`%.,5,19
Else Traytip, Master Volume, Master Volume is at %Level%`%.,5,17

but for some reason it doesn't work.

I've also started to build a GUI, but I can't figure out how to add labels or save variables. Here's what I have so far.

Gui, Add, Hotkey, x146 y10 w30 h20 
Gui, Add, Hotkey, x146 y40 w30 h20 
Gui, Add, Hotkey, x146 y70 w30 h20 
Gui, Add, Button, x6 y100 w40 h20 , OK
Gui, Add, Button, x66 y100 w40 h20 , Quit
Gui, Add, Text, x6 y10 w130 h20 , Increase Master Volume:
Gui, Add, Text, x6 y40 w130 h20 , Decrease Master Volume:
Gui, Add, Text, x6 y70 w130 h20 , Mute Master Volume:

Gui, Show, x307 y163 h131 w191, New GUI Window
Return

GuiClose:
ExitApp

I know it's not much, but I've got the basic layout. I'm trying to figure out how to save the hotkeys as variables to add to your code, but I can't figure it out, same with the buttons. Is there some example code I can look at? I tried looking through the example scripts, but nothing.

chezduong
Offline
Last seen: 1 week 6 days ago
Joined: 2006-12-06 04:01
Devo,

Yea, I know. Traytip is very nice, but the time it remains on the screen is not controllable. See below.

The approximate number of seconds to display the window, after which it will be automatically removed by the OS. Specifying a number less than 10 or greater than 30 will usually cause the minimum (10) or maximum (30) display time to be used instead. If blank or omitted, the minimum time will usually be used. This parameter can be an expression.

The actual timeout may vary from the one specified. Microsoft explains, "if the user does not appear to be using the computer, the system does not count this time towards the timeout." (Technical details here.) Therefore, to have precise control over how long the TrayTip is displayed, use the Sleep command followed by TrayTip with no parameters, or use SetTimer as illustrated in the Examples section below.

I've tried to use other things like progress bars, text boxes, etc., but they flicker when moving the volume by quite a few percentages. I've also tried Tooltip, but the display is just too small. So I just live with the little quirks of Traytip. Let me know if you find the solution.

Concerning the GUI command, I am not a specialist at this. You might want to try the following link:

http://www.autohotkey.com/docs/commands/Gui.htm#Events

Try
GUI, vMyVariable,… or
GUI, gMySubroutine

where MyVariable and MySubroutines are what you want to store and what you want the GUI to do, respectively.

Boom! …woops, I just hit the limit of my AutoHotkey knowledge. Ouch.

Devo
Offline
Last seen: 4 months 2 weeks ago
Joined: 2007-09-04 14:55
GUI

I was trying to set up a GUI so the user could create their own hotkeys. I'm sure it would be pretty easy for someone who's been using AHK, but I'm struggling trying to fight my way through the Help file. I'll bet wraithdu could knock this out in 15 mintues, hopefully he'll take a look at this topic.

ZachHudock
ZachHudock's picture
Offline
Last seen: 4 years 7 months ago
Developer
Joined: 2006-12-06 18:07
wraithdu actually uses

wraithdu actually uses AutoIt, not AHK

The developer formerly known as ZGitRDun8705

Devo
Offline
Last seen: 4 months 2 weeks ago
Joined: 2007-09-04 14:55
Aren't they pretty much the

Aren't they pretty much the same? I thought AutoHotkey was the OSS version of Auto-It

ZachHudock
ZachHudock's picture
Offline
Last seen: 4 years 7 months ago
Developer
Joined: 2006-12-06 18:07
They were at first, but now

They were at first, but now there are some pretty big syntax differences

The developer formerly known as ZGitRDun8705

arqbrulo
arqbrulo's picture
Offline
Last seen: 2 years 5 months ago
Joined: 2006-08-10 16:38
Thanks

Thanks, chezduong, that works. I really don't know how to use AutoHotkey, but I'll see if I can add a scroll bar to it (unless someone like Devo does it before me).

"In three words I can sum up everything I've learned about life: it goes on." -- Robert Frost
"In three words I can sum up everything I've learned about life: baby ain't mine." -- Adam Holguin

chezduong
Offline
Last seen: 1 week 6 days ago
Joined: 2006-12-06 04:01
Forum

arqbrulo,

Look in the AHK forum. They have some really cool and elaborate scripts. Do a search for OSD Volume Control by Rajat (I think). It is really elaborate if you don't mind having a separate script running all the time.

I prefer to have smaller, personal scripts all in one file running all the time so I delete most of the eye-candy and functionalities that I know I do not need.

Ciao.

arqbrulo
arqbrulo's picture
Offline
Last seen: 2 years 5 months ago
Joined: 2006-08-10 16:38
Yes, on help file

Yes, the Volume OSD is found in the help file of AHK. It does what I was hoping. Thanks for your help and for your script.

"In three words I can sum up everything I've learned about life: it goes on." -- Robert Frost
"In three words I can sum up everything I've learned about life: baby ain't mine." -- Adam Holguin

Log in or register to post comments