Skip to content

Instantly share code, notes, and snippets.

@datmt
Last active July 1, 2022 07:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save datmt/5b7d17e8886d14bb0024f8e6c45dabcd to your computer and use it in GitHub Desktop.
Save datmt/5b7d17e8886d14bb0024f8e6c45dabcd to your computer and use it in GitHub Desktop.
Autohotkey script to start program on hotkey pressed
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SetTitleMatchMode, 2
!c::
if WinExist("ahk_exe chrome.exe")
{
WinActivate
} else
{
Run "C:\Users\myn\AppData\Local\Google\Chrome SxS\Application\chrome.exe"
}
Return
!f::
if WinExist("ahk_exe chrome.exe")
{
WinActivate
} else
{
Run "C:\Program Files\Mozilla Firefox\firefox.exe"
}
Return
!s::
if WinExist("ahk_exe photoshop.exe")
{
WinActivate
} else
{
Run "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Adobe Photoshop 2020.lnk"
}
Return
!n::
if WinExist("ahk_exe notepad++.exe")
{
WinActivate
} else
{
Run "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Notepad++.lnk"
}
Return
!a::
if WinExist("ahk_exe chrome.exe")
{
WinActivate
} else
{
Run "C:\Program Files\Android\Android Studio\bin\studio64.exe"
}
Return
!r::
if WinExist("ahk_exe FoxitPDFReader.exe")
{
WinActivate
} else
{
Run "C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE"
}
Return
!p::
if WinExist("ahk_exe chrome.exe")
{
WinActivate
} else
{
Run "C:\Program Files\JetBrains\PhpStorm 2018.2.5\bin\phpstorm64.exe"
}
Return
!j::
if WinExist("ahk_exe idea64.exe")
{
WinActivate
} else
{
Run "C:\Users\myn\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\JetBrains Toolbox\IntelliJ IDEA Ultimate.lnk"
}
Return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment