Skip to content

Instantly share code, notes, and snippets.

@Ink230
Created July 28, 2022 00:12
Show Gist options
  • Save Ink230/9693b0c067aef6bee645ec9d9ee887fa to your computer and use it in GitHub Desktop.
Save Ink230/9693b0c067aef6bee645ec9d9ee887fa to your computer and use it in GitHub Desktop.
Windows Productivity AutoHotKey
#NoEnv
SetTitleMatchMode, 2
;direct window switch keys
;most common should be used here
Ins::
SwitchToWindowsTerminal()
return
Home::
OpenWindow("Google Chrome","C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 1")
return
Del::
OpenWindow("Microsoft Visual Studio","C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe")
return
PgUp::
OpenWindow("Visual Studio Code","C:\Program Files\Microsoft VS Code\Code.exe")
return
PgDn::
OpenWindow("Word","C:\Program Files\Microsoft Office\root\Office16\WINWORD.EXE")
return
End::
OpenWindow("Excel","C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE")
return
;secondary windows used often but not
;frequently together, one offs
^Ins::
OpenWindow("WhatsApp","C:\Users\Justin\AppData\Local\WhatsApp\WhatsApp.exe")
return
^Home::
OpenWindow("Discord","C:\Users\Justin\AppData\Local\Discord\Update.exe --processStart Discord.exe")
return
^PgUp::
OpenWindow("Messenger","C:\Users\Justin\AppData\Local\Programs\Messenger\Messenger.exe")
return
^PgDn::
OpenWindow("Microsoft Teams","C:\Users\Justin\AppData\Local\Microsoft\Teams\Update.exe --processStart ""Teams.exe"" --process-start-args ""--profile=AAD""")
return
^Del::
OpenWindow("ahk_exe Spotify.exe","C:\Users\Justin\AppData\Roaming\Spotify\Spotify.exe")
return
^End::
OpenWindow("OneNote","C:\Program Files\Microsoft Office\root\Office16\ONENOTE.EXE")cmd
return
;Rare windows and very quick and often used
;text input macros
+Ins::
OpenWindow("VoiceMeeter","C:\Program Files (x86)\VB\Voicemeeter\voicemeeterpro.exe")
return
+Home::
OpenWindow("ahk_exe thunderbird.exe", "C:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe")
return
+PgUp::
OpenWindow("SumatraPDF","C:\Program Files\SumatraPDF\SumatraPDF.exe")
return
+Del::
OpenWindow("paint.net","C:\Program Files\paint.net\PaintDotNet.exe")
return
+End::
Openwindow("Steam", "C:\Program Files (x86)\Steam\Steam.exe")
return
!Ins::
Run, explore "C:\Users\Justin\Downloads"
return
!Home::
Run, explore "C:\Users\Justin"
return
!PgUp::
Run, explore "C:\Users\Justin\University"
return
!PgDn::
Run, explore "C:\C#"
return
!End::
Run, explore "D:\"
return
!Del::
Run, explore "Z:\"
return
;often used 2 macros
NumLock::SendRaw •
Pause::Send {Delete}
^CtrlBreak::SendRaw ✔
<#B::
WinMaximize, A
return
<#C::
WinClose, A
return
<#`::
SendInput, !```
return
OpenWindow(TargetWindow, Path)
{
if (WinExist(TargetWindow))
{
WinActivate, %TargetWindow%
}
else
{
Run, %Path%
WinWait, %TargetWindow%
WinActivate, %TargetWindow%
}
}
SwitchToWindowsTerminal()
{
windowHandleId := WinExist("ahk_exe WindowsTerminal.exe")
windowExistsAlready := windowHandleId > 0
; If the Windows Terminal is already open, determine if we should put it in focus or minimize it.
if (windowExistsAlready = true)
{
activeWindowHandleId := WinExist("A")
windowIsAlreadyActive := activeWindowHandleId == windowHandleId
if (windowIsAlreadyActive)
{
; Minimize the window.
WinMinimize, "ahk_id %windowHandleId%"
}
else
{
; Put the window in focus.
WinActivate, "ahk_id %windowHandleId%"
WinShow, "ahk_id %windowHandleId%"
}
}
; Else it's not already open, so launch it.
else
{
Run, wt
}
}
#IfWinActive ahk_exe notepad.exe
tab::
loop 2
send % A_Space
return
#If
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment