Created
August 5, 2016 18:43
-
-
Save AndreyAkinshin/c5e6a4123336c1f6a4f87416772e18b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
#SingleInstance force | |
; #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. | |
SetCapsLockState, AlwaysOff | |
; Based on https://gist.github.com/ronjouch/2428558 | |
; Variables definition | |
; ----------------------------------------------------------------------------- | |
EnvGet, userProfile, USERPROFILE | |
; Launch or toggle program, http://lifehacker.com/5468862/create-a-shortcut-key-for-restoring-a-specific-window | |
; ----------------------------------------------------------------------------- | |
ToggleWinMinimize(WindowTitle) | |
{ | |
SetTitleMatchMode,2 | |
DetectHiddenWindows, Off | |
IfWinActive, %WindowTitle% | |
WinMinimize, %WindowTitle% | |
Else | |
IfWinExist, %WindowTitle% | |
{ | |
WinActivate | |
} | |
Return | |
} | |
RunOrActivateOrMinimizeProgram(Program, WorkingDir="", WindowSize="") | |
{ | |
SplitPath Program, ExeFile | |
Process, Exist, %ExeFile% | |
PID = %ErrorLevel% | |
if (PID = 0) | |
{ | |
Run, %Program%, %WorkingDir%, %WindowSize% | |
} | |
else | |
{ | |
SetTitleMatchMode,2 | |
DetectHiddenWindows, Off | |
IfWinActive, ahk_pid %PID% | |
WinMinimize, ahk_pid %PID% | |
Else | |
IfWinExist, ahk_pid %PID% | |
WinActivate, ahk_pid %PID% | |
Send, {LWin}+{NumpadUp} | |
Return | |
} | |
} | |
Capslock & D::RunOrActivateOrMinimizeProgram("C:\Program Files\Double Commander\doublecmd.exe") | |
Capslock & A::RunOrActivateOrMinimizeProgram("C:\Program Files (x86)\AIMP3\AIMP.exe") | |
Capslock & F::RunOrActivateOrMinimizeProgram("C:\Program Files (x86)\Mozilla Firefox\firefox.exe") | |
Capslock & T::RunOrActivateOrMinimizeProgram("C:\Program Files\Sublime Text 3\sublime_text.exe") | |
Capslock & P::RunOrActivateOrMinimizeProgram("C:\Program Files\Process Hacker 2\ProcessHacker.exe") | |
Capslock & L:: | |
RunOrActivateOrMinimizeProgram("C:\Users\jetbrains\AppData\Local\slack\app-2.1.0\slack.exe") | |
Send {Esc} | |
Return | |
Capslock & S:: | |
Process, Exist, Skype.exe | |
PID = %ErrorLevel% | |
if (PID = 0) | |
{ | |
Run, "C:\Program Files (x86)\Skype\Phone\Skype.exe" | |
} | |
else | |
{ | |
Send !+^s | |
ControlClick, TChatRichEdit1, ahk_class tSkMainForm,,,,,, | |
ControlClick, TChatRichEdit2, ahk_class tSkMainForm,,,,,, | |
ControlClick, TChatRichEdit3, ahk_class tSkMainForm,,,,,, | |
} | |
return | |
Capslock & C:: | |
Process, Exist, ConEmu.exe | |
PID = %ErrorLevel% | |
if (PID = 0) | |
{ | |
Run, "C:\bin\cmder\vendor\conemu-maximus5\ConEmu.exe" | |
} | |
else | |
{ | |
Send ^\ | |
} | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment