; taskbar-middle-close.ahk requires AutoHotKey and allows ; closing a window by middle-clicking its taskbar button. ; DO NOT USE THIS WITH TASKBAR GROUPING ENABLED: ; explorer.exe behaves very strangely when sending Alt-F4 to a ; taskbar menu group (it presents the shutdown dialog) ; DO NOT USE THIS IN A PRODUCTION ENVIRONMENT: ; It can erronously send Alt-F4 to any window if the checks in MButton:: fail! ; This script might behave strangely on vertical multi-monitor setups or ; on multiple monitors with different resolutions. ; ================================ ; Version 0.1 hacked together by Ivan Kozik on 2006-07-26 ; See http://ludios.org/code/ ; Public domain ; ================================ ; This is an additional check in case Windows lies about the active control. ; Set this to 0 if your taskbar is not at the bottom of the screen or has ; multiple rows. enablePosCheck = 1 ; Set your taskbar height here in pixels if the above check is enabled ; (default = 23) taskBarHeight = 23 StartY = % A_ScreenHeight - taskBarHeight CoordMode, Mouse, Screen ~MButton:: MouseGetPos, x, y, window, control If (y > StartY or enablePosCheck == 0) { ; If the click was on the taskbar, the control name is usually ; ToolbarWindow322 and ToolbarWindow323 (second display) StringGetPos, pos, control, ToolbarWindow if ErrorLevel { ; Click event was _not_ on the ToolbarWindow } else { ; Click event was on the ToolbarWindow ; Need to double click quickly to allow for the closure of the ; active window. Click Click Send !{F4} } } return