;TaskbarSize.ahk ; Resizes the taskbar when it gets too crowded ;Skrommel @ 2008 Menu, Tray, Icon, Shell32.dll, 135 #SingleInstance,Force DetectHiddenWindows, On SetWinDelay,0 setmousedelay,0 ;CoordMode, Mouse, Screen ;taskbarsize=1 ;30-42 ;WinMove,ahk_class Shell_TrayWnd,,100,0 buttonlimit=5 WinGetPos,tx,ty,tw,th,ahk_class Shell_TrayWnd WinGet, pidTaskbar, PID, ahk_class Shell_TrayWnd hProc:= DllCall("OpenProcess", "Uint", 0x38, "int", 0, "Uint", pidTaskbar) pProc:= DllCall("VirtualAllocEx", "Uint", hProc, "Uint", 0, "Uint", 32, "Uint", 0x1000, "Uint", 0x4) idxTB:= GetTaskSwBar() oldbuttons:=buttons SendMessage, 0x418, 0, 0, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd ; TB_BUTTONCOUNT previous:=ErrorLevel Loop { Sleep,1000 WinGetPos,tx,ty,tw,th,ahk_class Shell_TrayWnd idxTB:= GetTaskSwBar() oldbuttons:=buttons SendMessage, 0x418, 0, 0, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd ; TB_BUTTONCOUNT buttons:=ErrorLevel If (oldbuttons=buttons) Continue if th between 30 and 40 If (buttons>14*2) ;If (buttons>previous+buttonlimit) { keywait,LButton keywait,Alt keywait,Control keywait,LWin winid:=WinExist("A") WinActivate, ahk_class Shell_TrayWnd ;PostMessage, 0x112, 0xF000,,, ahk_class Shell_TrayWnd ; SC_SIZE ;msgbox,REsizing...bigger MouseGetPos,mx,my BlockInput,On mousemove,1,1,0 MouseClickDrag,L,0,0,0,-30,0,R MouseMove,% mx,% my,0 BlockInput,Off WinActivate,ahk_id %winid% previous:=previous+buttonlimit } if th > 54 If (buttons<11*2) ;If (buttons