A simple keyboard volume control
A simple keyboard volume control
Greetings
I was hoping someone may be interested in beta testing this for me.
Outdated link removed
It is a very simple keyboard and mouse master volume control written in AutoHotkey. It is portable and should run on Win 2000 XP and Vista, though in Vista you will need to run it in XP compatibility mode. It will not run on Win7 due to issues with AHk and the Win7 sound API.
I wrote this in about three hours yesterday, so nothing about it is final, including the name. I would appreciate any ideas for improvement. Please contact me with ideas via the private messaging system. My goal is simply to get this to the point that it can be considered good enough to list here at TPFC. I am doing this mostly as a programming exorcise, and this is my first polished application so please be kind in your criticism. The source script is included. Thanks
I was hoping someone may be interested in beta testing this for me.
Outdated link removed
It is a very simple keyboard and mouse master volume control written in AutoHotkey. It is portable and should run on Win 2000 XP and Vista, though in Vista you will need to run it in XP compatibility mode. It will not run on Win7 due to issues with AHk and the Win7 sound API.
I wrote this in about three hours yesterday, so nothing about it is final, including the name. I would appreciate any ideas for improvement. Please contact me with ideas via the private messaging system. My goal is simply to get this to the point that it can be considered good enough to list here at TPFC. I am doing this mostly as a programming exorcise, and this is my first polished application so please be kind in your criticism. The source script is included. Thanks
Last edited by dmg on Thu Oct 07, 2010 3:14 am, edited 4 times in total.
Re: A simple keyboard volume control
If you change your mind about releasing the code, I'd be glad to help test.
Re: A simple keyboard volume control
The zip file now includes the source.
Re: A simple keyboard volume control
For anyone who had trouble downloading the file, it is now fixed. I have never used file hosting before and I accidentally had the file set to private. My apologies.
Re: A simple keyboard volume control
No problems, no crash, no loss of functionality. Buttons very responsive. No delay and no confusion if I press mute on and off repeatedly. I couldn't get it to work with my mouse wheel, but that may be my unusual setup: tested on WinXP SP3 on a Mac under VMware.
The only negative I can see is that the program takes up 4.3 megs of RAM, which really isn't a big negative: HotKeys (http://www.portablefreeware.com/index.php?id=254) takes up over 7. I'm not sure how much Volumouse (http://www.portablefreeware.com/index.php?id=1340) takes up, but yours is much simpler, has simple and obvious mute functionality, as well as being open and in AHK.
Nice work and thanks for posting.
The only negative I can see is that the program takes up 4.3 megs of RAM, which really isn't a big negative: HotKeys (http://www.portablefreeware.com/index.php?id=254) takes up over 7. I'm not sure how much Volumouse (http://www.portablefreeware.com/index.php?id=1340) takes up, but yours is much simpler, has simple and obvious mute functionality, as well as being open and in AHK.
Nice work and thanks for posting.
Re: A simple keyboard volume control
Seems you AutoHotKey studying has improved tenfold! Also with reference to the RAM issue there might be a function floating around the AutoHotKey to "Reduce RAM," I know there is in AutoIt!
Re: A simple keyboard volume control
Thanks guys. I will look into the ram issue and let you know.
Does anyone have an opinion on which hotkeys I chose to use? Any reasons, conflicts etc. why it would be better to use a different set? Thanks.
Does anyone have an opinion on which hotkeys I chose to use? Any reasons, conflicts etc. why it would be better to use a different set? Thanks.
Re: A simple keyboard volume control
Try this version.
Outdated link removed
Now it empties all variables at the end of each operation set. This may not help ram usage by much but it is all I could think of at this point.
What method are you using to check ram usage?
Outdated link removed
Now it empties all variables at the end of each operation set. This may not help ram usage by much but it is all I could think of at this point.
What method are you using to check ram usage?
Last edited by dmg on Thu Oct 07, 2010 3:15 am, edited 1 time in total.
Re: A simple keyboard volume control
Some Ideas >> http://www.autohotkey.com/forum/topic53543.html Or http://www.sevenforums.com/customizatio ... ift-2.html. As I have mentioned before I have no expertise in AutoHotKey, but I did some research (searched for AutoHotKey - EmptyWorkingSet) and I think the example in AutoHotKey will help you to reduce the Memory usage of the running application! And it's safe as it's using the Windows API
AutoHotKey
My Example taken and modified from the AutoIt Forums.
_ReduceMemory() ; Call the Function to reduce the Memory usage of the current Process. Or ...
_ReduceMemory("Opera.exe") To reduce the Memory usage of Opera! (if running)
AutoHotKey
Code: Select all
_EmptyWorkingSet() ; http://www.sevenforums.com/customization/40297-can-copy-path-enabled-permanently-without-shift-2.html
{
Return DllCall("psapi.dll\EmptyWorkingSet", "UInt", -1)
}
_ReduceMemory() ; Call the Function to reduce the Memory usage of the current Process. Or ...
_ReduceMemory("Opera.exe") To reduce the Memory usage of Opera! (if running)
Code: Select all
Func _ReduceMemory($rm_PID = -1)
If $rm_PID <> -1 Then
Local $rm_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $rm_PID)
Local $rm_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $rm_Handle[0])
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $rm_Handle[0])
Else
$rm_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
EndIf
Return $rm_Return[0]
EndFunc ;==>_ReduceMemory
Re: A simple keyboard volume control
Thanks guinness. I tried this a few different ways in my script but it did not seem to help. When placed in the auto execute section it DOES reduce the initial ram used by a lot, but the effect is temporary. And I could not tell it did anything when placed in other areas of the script. I will keep playing around with it, but for now it looks like the volume control may just be a bit of a ram hog.
Can anyone tell me if emptying the variables helped at all?
Can anyone tell me if emptying the variables helped at all?
Re: A simple keyboard volume control
I like what you have set now and think you could stick with that without too many problems. However, if you're hoping to put this program on a lot of people's computers, its hard to find a key combo that won't run into conflicts. Some specialized programs out there used 8 hours a day by people have 200 different key combinations to speed up the process. For others, a mute button may be really important to you, so you'll want it to be super easy to do (win+tab or something). If possible some kind of customization would be helpful, even if its physically editing an INI file.dmg wrote:Does anyone have an opinion on which hotkeys I chose to use? Any reasons, conflicts etc. why it would be better to use a different set? Thanks.
But to your question, here's some possible defaults:
- "win" + "=" and "win" + "-" (The = sign because most people see the + symbol.)
- "ctrl+shift+up" , "ctrl+shift+down" and "ctrl+shift+z" for mute (I know that sounds odd but that's my actual setup with Foobar)
Just the Task Manager. ctrl+shift+escapedmg wrote:What method are you using to check ram usage?
Re: A simple keyboard volume control
You have to keep calling the Function, so if I am using a While...WEnd loop then I just call the Function everytime. But for your script I think its best if you put the Function call at the start of all your functions! Also to note clearing the Variables doesn't reduce any RAM, especially the amount of data your Variables are holding. If it was an Array with 100,000,000 items then it would a good idea to consider resetting if useless.
Re: A simple keyboard volume control
@webfork
I have a loose idea for customizing hotkeys. I will work on it. The design of AHk does not really consider the concept of using anything other than hard code to determine an input method, ie choosing a hotkey.
@guinness
I tried placing the function in each of my script's operations but all I got was an error message saying I had duplicated a function. There is a section at the end of my script to remove the tray tip, which is activated at the end of each script operation. I tried placing your function there but it did not seem to do anything. As I said, I will keep trying it. And thanks again.
Edit:
Success! It works wonderfully. Apparently you have to place the function itself in one place in the script, then place the name of the function at the point in the script where you want the function to activate. Who knew?! Now the ram hovers between 500kb and 900kb. Thank you for the solution guinness!
I will work on making the hotkeys customizable, and post a new version if and when I figure that out. Thanks again guys for your help.
I have a loose idea for customizing hotkeys. I will work on it. The design of AHk does not really consider the concept of using anything other than hard code to determine an input method, ie choosing a hotkey.
@guinness
I tried placing the function in each of my script's operations but all I got was an error message saying I had duplicated a function. There is a section at the end of my script to remove the tray tip, which is activated at the end of each script operation. I tried placing your function there but it did not seem to do anything. As I said, I will keep trying it. And thanks again.
Edit:
Success! It works wonderfully. Apparently you have to place the function itself in one place in the script, then place the name of the function at the point in the script where you want the function to activate. Who knew?! Now the ram hovers between 500kb and 900kb. Thank you for the solution guinness!
I will work on making the hotkeys customizable, and post a new version if and when I figure that out. Thanks again guys for your help.
Re: A simple keyboard volume control
Here is a link to the new version, beta 5.
Outdated link removed
Changes:
Hotkeys are customizable
Icons are customizable
Tooltip and icon changes to represent current status, ie muted or suspended
Custom tray menu
Generates keys.ini if not found on start
Generates readme.txt if opened from the tray and not found
Generates keys.ini if not found when Edit is chosen from the tray menu
Calls EmptyWorkingSet once 30 seconds after application start, and at the end of each operation
Please play around with it and let me know what you think. All comments and suggestions are welcome.
Including ideas for a more imaginative name.
Outdated link removed
Changes:
Hotkeys are customizable
Icons are customizable
Tooltip and icon changes to represent current status, ie muted or suspended
Custom tray menu
Generates keys.ini if not found on start
Generates readme.txt if opened from the tray and not found
Generates keys.ini if not found when Edit is chosen from the tray menu
Calls EmptyWorkingSet once 30 seconds after application start, and at the end of each operation
Please play around with it and let me know what you think. All comments and suggestions are welcome.
Including ideas for a more imaginative name.
Last edited by dmg on Thu Oct 14, 2010 8:50 pm, edited 1 time in total.
Re: A simple keyboard volume control
OK, so had a play around with it this time and it doesn't work!, like the popup bubble!
So I think the problem is with Vista and later...http://www.autohotkey.com/docs/commands/SoundSet.htm, if you see the remarks it's best to use
Sorry about this
Potential name(s): Volume Key, VKey, Pushey, Vlick (Volume Click!)
So I think the problem is with Vista and later...http://www.autohotkey.com/docs/commands/SoundSet.htm, if you see the remarks it's best to use
Code: Select all
Send {Volume_Up} ; Raise the master volume by 1 interval (typically 5%).
Send {Volume_Down 3} ; Lower the master volume by 3 intervals.
Send {Volume_Mute} ; Mute/unmute the master volume.
Potential name(s): Volume Key, VKey, Pushey, Vlick (Volume Click!)