That damn auto-hide taskbar is quite difficult to tame.
Maybe code can be more fine-tuned, but I tried several things, and at the end always some problem came up again.
I did some testing, and this seems to work, but not 100% guarantee:
Code:
WinGet, taskbarID, id, ahk_class Shell_TrayWnd
#IfWinNotActive ahk_class Shell_TrayWnd ; taskbar is not active window
#b::
WinGet, activeID, id, A
WinSet, Style, ^0xC00000, ahk_id %activeID%
WinGet, winStyle, style, ahk_id %activeID%
if !(winStyle & 0xC00000){
sleep 1500 ; delay seems necessary, I don't know exactly why though
DllCall("SetWindowPos", "uint", taskbarID, "uint",0, "int",0, "int",0, "int",0, "int", 0, "uint", 0x253)
; 0x253: SWP_NOACTIVATE= 0x10 SWP_NOOWNERZORDER= 0x200
; SWP_SHOWWINDOW= 0x40 SWP_NOMOVE= 2 & SWP_NOSIZE= 1 (->all coord. can = 0)
WinGetPos, X, Y, Width, winH, ahk_id %activeID%
WinMove, ahk_id %activeID%, , , , , % winH - 6 ; necessary? after a Win-key
WinSet, AlwaysOnTop, off, ahk_class Shell_TrayWnd
WinSet, AlwaysOnTop, on, ahk_class Shell_TrayWnd
tooltip taskbar recovered ; for testing
}
else
tooltip
return
#IfWinNotActive