AutoHotkey: Scratchpad

Another day, another hack. This AutoHotkey snippet preserves the last window you minimized with Win + Down and allows you to quickly unminimize it with Win + Shift + Up:

global lastWindow
ToScratchpad()
{
    WinGetTitle, lastWindow, A
    WinMinimize, %lastWindow%
}
FromScratchpad()
{
    WinActivate, %lastWindow%
}
#Down::ToScratchpad()
#+Up::FromScratchpad()

Update 06/11/2019: the script was slightly tweaked to handle apps with more than one window better.