mihaibr Posted December 2, 2012 Share Posted December 2, 2012 (edited) Hi,Today I bought a new keyboard and at home I noticed that it doesn't have buttons for the volume control(VolumeUP,VolumeDOWN and MUTE), so I created this script:expandcollapse popup#include "SoundGetSetQuery.au3" Global $bState=False,$aIcon[4]=["low.ico","med.ico","max.ico","mute.ico"] $iVolume=_SoundGet(0, "dSpeakers", 1, "Volume") If $iVolume<=33 Then TraySetIcon($aIcon[0]) If $iVolume>33 And $iVolume<=66 Then TraySetIcon($aIcon[1]) If $iVolume>66 And $iVolume<=100 Then TraySetIcon($aIcon[2]) HotKeySet("{PGUP}","up");VolumeUP HotKeySet("{PGDN}","down");VolumeDOWN HotKeySet("{INS}","mute");VolumeMUTE Func up() If $bState==False Then $iVolume=_SoundGet(0, "dSpeakers", 1, "Volume") Send("{VOLUME_UP}") If $iVolume<=33 Then TraySetIcon($aIcon[0]) If $iVolume>33 And $iVolume<=66 Then TraySetIcon($aIcon[1]) If $iVolume>66 And $iVolume<=100 Then TraySetIcon($aIcon[2]) EndIf EndFunc Func down() If $bState==False Then $iVolume=_SoundGet(0, "dSpeakers", 1, "Volume") Send("{VOLUME_DOWN}") If $iVolume>=1 And $iVolume<=33 Then TraySetIcon($aIcon[0]) If $iVolume>33 And $iVolume<=66 Then TraySetIcon($aIcon[1]) If $iVolume>66 And $iVolume<=100 Then TraySetIcon($aIcon[2]) If $iVolume==0 Then TraySetIcon($aIcon[3]) EndIf EndFunc Func mute() If $bState==True Then $iVolume=_SoundGet(0, "dSpeakers", 1, "Volume") Send("{VOLUME_MUTE}") If $iVolume>=1 And $iVolume<=33 Then TraySetIcon($aIcon[0]) If $iVolume>33 And $iVolume<=66 Then TraySetIcon($aIcon[1]) If $iVolume>66 And $iVolume<=100 Then TraySetIcon($aIcon[2]) If $iVolume==0 Then TraySetIcon($aIcon[3]) $bState=False Else Send("{VOLUME_MUTE}") TraySetIcon($aIcon[3]) $bState=True EndIf EndFunc While True Sleep(10) WEndHere you can find out the script with the original indentation: http://pastebin.com/cCerHina I attached the icon in this post.The include "SoundGetSetQuery.au3" can be found here: I chose the keys "PGUP","PGDN" and "INS" because I use them rare.I extracted the icons from this iconset: http://www.iconarchive.com/show/oxygen-icons-by-oxygen-icons.org.1.htmlicons.7z Edited December 2, 2012 by mihaibr Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now