I was looking for something like this for a while, and this thread helped me finally make something that works, so I figured I would let people know how to do it.
Thanks very much to EricCartman for the function calls, really all I did was fix the structure of the code.
Eric's code was working perfectly until I realized it was using 25% processor

when the taskbar was showing.
This code uses no looping mechanisms, so it doesn't do anything except when you want it to.
Code:
{
DetectHiddenWindows, On
VarSetCapacity( APPBARDATA, 36, 0 )
NumPut( ( ABS_ALWAYSONTOP := 0x2 )|( ABS_AUTOHIDE := 0x1 ), APPBARDATA, 32, "UInt" )
DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
Sleep 10 ;Sometimes the bar doesn't get hidden 'all of the way' this prevents that.
WinHide ahk_class Shell_TrayWnd
} ;If you want the taskbar to start visible, delete this block.
x=1
f12:: ;The key used to toggle the taskbar. Change it as you like.
{
If x=0
{
NumPut( ( ABS_ALWAYSONTOP := 0x2 ), APPBARDATA, 32, "UInt" )
DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
WinShow ahk_class Shell_TrayWnd
x=1
return
}
If x=1
{
DetectHiddenWindows, On
VarSetCapacity( APPBARDATA, 36, 0 )
NumPut( ( ABS_ALWAYSONTOP := 0x2 )|( ABS_AUTOHIDE := 0x1 ), APPBARDATA, 32, "UInt" )
DllCall( "Shell32.dll\SHAppBarMessage", "UInt", ( ABM_SETSTATE := 0xA ), "UInt", &APPBARDATA )
Sleep 10
WinHide ahk_class Shell_TrayWnd
x=0
return
}
}
For people wondering how to 'install'/ 'where' to write this (as I did at first): 1-Download and install autohotkey. 2-Simply copy the above code and paste it into notepad. 3-save this file as a .ahk file. 4-open the file to run the script.
I'm not sure how to get this to happen automatically when you log in, but I don't know that much about autohotkey. I'm sure there is some way to do it if you look
Hope this helps.