Windows – How to toggle the auto-hide status of the Windows taskbar

autohotkeytaskbarwindows 8

I use Windows 8 on my desktop. Currently I have to move my mouse over the taskbar, right click, click on properties, click on auto-hide the taskbar, and then click OK. This is a real pain if you want to toggle this status between on and off several times during the day. In fact, it's unworkable, so it stays on by default and wastes a lot of screen real estate when I don't need it.

Is there a better way?

(If it helps, I use Autohotkey.)

Best Answer

Here is an AutoHotKey script to make Win+b into a hotkey that toggles the taskbar auto-hide setting:

VarSetCapacity(APPBARDATA, A_PtrSize=4 ? 36:48)

#b::
   NumPut(DllCall("Shell32\SHAppBarMessage", "UInt", 4 ; ABM_GETSTATE
                                           , "Ptr", &APPBARDATA
                                           , "Int")
 ? 2:1, APPBARDATA, A_PtrSize=4 ? 32:40) ; 2 - ABS_ALWAYSONTOP, 1 - ABS_AUTOHIDE
 , DllCall("Shell32\SHAppBarMessage", "UInt", 10 ; ABM_SETSTATE
                                    , "Ptr", &APPBARDATA)
   KeyWait, % A_ThisHotkey
   Return

If you wish to use a different key or key combination than Win+b, change the #b before the double colons in line 3 to whatever hotkey you want (using the syntax in the AutoHotKey documentation).