#SingleInstance Force #NoEnv ;#NoTrayIcon ;uncomment if you want to be sneaky... LastClick = 0 CoordMode, Mouse, Screen ;Get this at http://www.autohotkey.net/~ManaUser/KBoom.wav FileInstall KBoom.wav, %A_Temp%\KBoom.wav sStr = OPEN %A_Temp%\KBoom.wav TYPE waveaudio ALIAS KBoom DllCall("winmm.dll\mciExecute", "Str", sStr) OnExit DoExit GroupAdd System, ahk_class ExploreWClass ;Windows Explore GroupAdd System, ahk_class CabinetWClass ;My Computer type window GroupAdd System, ahk_class Shell_TrayWnd ;Task bar GroupAdd System, ahk_class Progman ;Desktop ~LButton:: If WinActive("ahk_group System") Return ClickSpeed := A_TickCount - LastClick If (ClickSpeed > 200) ;rough approximation of a double-click. { LastClick := A_TickCount Return } MouseGetPos X, Y, Win WinGetPos WX, WY, , , ahk_id %Win% X -= WX ;adjsut for screen co-ord mode. Y -= WY Pattern = 0:-5|4:-12|4:-6|8:-7|7:-3|11:-2|7:-1|13:1|7:0|12:4|8:3|10:6|13:7|10:7|10:9|9:6|5:4|7:10|3:5|3:11|0:7|-2:14|-3:6|-6:9|-5:4|-11:5|-6:2|-11:-2|-6:-3|-10:-10|-3:-5|-2:-7|-3:-13|-1:-9|0:-11 ;These are off-sets from the cursor for each point in the shape. It was a pain to encode... CCrack := Crack%Win% ;get current shape (if any) from active window. CCrack .= " " . X . "-0" ;a point on at the top of the window, centered over the cutout. Loop Parse, Pattern, | { StringSplit XY, A_LoopField, : ;Parse the offset string and add the mouse position. CCrack .= " " . X + XY1 * 10 . "-" . Y + XY2 * 10 } CCrack .= " " . X . "-0" ;another point on at the top of the window, centered over the cutout. Crack%Win% := CCrack ;save shape in a unique variable for active window. sStr = PLAY KBoom FROM 0 DllCall("winmm.dll\mciExecute", "Str", sStr) ;Kaboom! sleep 100 WinSet Region, 0-0 %CCrack% 3000-0 3000-2000 0-2000, ahk_id %Win% ; So it "draws" a region like this... (2-4 repeat for each shape) ; ; 1----(2,4)----+ - - - - 5 ; | | | : ; | | | : ; | 3 | : ; | SHAPE | : ; | | : ; +-------------+ : ; : : ; : : ; 7 - - - - - - - - - - - 6 ; ; It's bigger than the window to allow for resizing. Return ^+!z:: Win := WinExist("A") WinSet Region, , ahk_id %Win% Crack%Win% = Return ^+!F12:: FileDelete %A_Temp%\KBoom.wav ExitApp Return DoExit: FileDelete %A_Temp%\KBoom.wav ExitApp Return