I found one of my last ct-magazines next to my bed last weekend. Because an influenca I was bound to bed and bored too. But the article about AHK was fascinating because it is the tool I was ever searching for. The example by Wolfgang from ct-mag was to open/close the CD-drive with an key. This was the first script I used to see how the syntax and Autohotkey works.
I was inspired by the Idea bringing this Mac Functions and OSD to Windows (And I was bored by the ugly green-bars-OSD shown by my keyboard driver). So I decided to write a volume OSD script with optimized functionality.
The special in my script is the modular system to build the OSD. But there are some questions too. Maybe someone can help me out. I can not interrupt the OSD fadeout by hitting volume_up/volume_down a second time to increase/decrease faster. When hitting volume_down whilst a volume_up script is still running (fadeout) the loop for building the noise-level (bullets) does not work.
But here's the script:
I used the script of Tekl as sample as well as someones(sorry, can't remember his name) mutechecker script
;_________________________________ ; OSD for OS X Volume hotkey declaration volume_up:: SoundSet, +100/16 gosub, buildOSD return volume_down:: SoundSet, -100/16 gosub, buildOSD return volume_mute:: SoundGet,checkmute,,MUTE if checkmute = Off { quietnow = 1 } else { quietnow = 0 } SoundSet, +1, , mute gosub, buildOSD return ;______________________ ; Build OSD for OS X Volume ; Parameter: ; quietnow - indicates if mute status is off and should switch to on ; transparent - the transparency at start of the fading buildOSD: transparent = 192 ; starting transparency ; calculate position by Tekl distY = %A_ScreenHeight% posY = %A_ScreenHeight% distY /= 4 posY -= %distY% ; create OSD background Gui, Add, pic,x0 y0, %A_ScriptDir%\area.bmp ; create OSD speaker SoundGet,checkmute,,MUTE if checkmute = On { if quietnow = 1 { currsnd = 0.0 currsnd +=0.0 quietnow = 0 } else { SoundGet, currsnd } Gui, Add, pic,x55 y50, %A_ScriptDir%\quiet.bmp } else { SoundGet, currsnd Gui, Add, pic,x55 y50, %A_ScriptDir%\loud.bmp } ; create OSD noise level bullets bullets = 16 bullets += 0.0 dermax = 100.0 dermax += 0.0 currbullet = %currsnd% currbullet /= %dermax% currbullet *= %bullets% Transform,currbullet,Round,%currbullet% Transform,bullets,Round,%bullets% loop, %bullets% { Transform,xbullet, Round, %bullets% xbullet *=9 xbullet +=24 ifgreaterorequal,currbullet,%bullets% { Gui, Add, pic,x%xbullet% y168, %A_ScriptDir%\fullbullet.bmp } else { Gui, Add, pic,x%xbullet% y168, %A_ScriptDir%\emptybullet.bmp } bullets -= 1 } DetectHiddenWindows on WinWait, %A_ScriptName% ; Set the "last found" window to GUI window. WinSet, TransColor,FF00FF %transparent% WinSet, AlwaysOnTop, On Gui, -Caption Gui, Show, w211 h206 y%posY% ; play the blob sound to hear the noise level SoundPlay, %A_ScriptDir%\sound.wav ; fade down the OSD by Tekl Loop, %transparent% { transparent -= 1 WinSet, TransColor,FF00FF %transparent% } Gui, Destroy returnYou can find the .ahk file and the pictures here http://www.croce.at/...cosx_volume.zip