Skip to content

Instantly share code, notes, and snippets.

@ntrp
Created November 24, 2019 17:13
Show Gist options
  • Save ntrp/bbd79b33772713f2f21d55c8c9ab344e to your computer and use it in GitHub Desktop.
Save ntrp/bbd79b33772713f2f21d55c8c9ab344e to your computer and use it in GitHub Desktop.
Windows Console show/hide shortcut
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
F1::
DetectHiddenWindows, on
IfWinExist, ahk_exe Arch.exe
{
IfWinActive, ahk_exe Arch.exe
{
WinHide, ahk_exe Arch.exe
SetTimer, ActivateLastWindow, 100
} else {
WinGet, winid,, A
WinShow, ahk_exe Arch.exe
WinActivate, ahk_exe Arch.exe
}
} else {
WinGet, winid,, A
Run, Arch.exe, , max
}
DetectHiddenWindows, off
return
ActivateLastWindow:
WinActivate, ahk_id %winid%
SetTimer, ActivateLastWindow, off
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment