Last active
December 10, 2022 01:13
-
-
Save mrreband/3d4a4a527dfa704980e234a9054f9c8b to your computer and use it in GitHub Desktop.
AutoHotKey config
This file contains hidden or 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
#If WinActive("ahk_exe Ableton Live 10 Suite.exe") | |
F2:: | |
send, ^r | |
Return | |
#if |
This file contains hidden or 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
#SingleInstance force | |
SetTitleMatchMode, 2 | |
; FYI: | |
; # = Win | |
; + = Shift | |
; ! = Alt | |
; ^ = Ctrl | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; string constants | |
#Include AutoHotkey\TextReplacements.ahk | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; app hotkeys (new instance, on current virtual desktop) | |
#N::Run, Notepad | |
; app hotkeys (single instance, active virtual desktop) | |
#C::OpenOrRun("ahk_exe chrome.exe", "Chrome.exe", 0) | |
#A::OpenOrRun("AutoHotkey.ahk - Notepad2", "Notepad.exe C:\users\mr\Documents\Autohotkey.ahk", 0) | |
; app hotkeys (single instance, on virtural desktop 1 (communication and browsing) | |
#O::OpenOrRun("ahk_exe OUTLOOK.EXE", "Outlook", 1) | |
#T::OpenOrRun("ahk_exe Teams.exe", "C:\Users\mr\AppData\Local\Microsoft\Teams\Update.exe", 1) | |
#H::OpenOrRun("Google Hangouts", "Chrome.exe hangout.google.com", 1) | |
#M::OpenOrRun("Messages for web", "C:\Program Files (x86)\Google\Chrome\Application\chrome_proxy.exe", 1) | |
; app hotkeys (single instance, on virtural desktop 2 (coding and reference) | |
#P::OpenOrRun("ahk_exe Powershell.exe", "Powershell", 2) | |
#S::OpenOrRun("Microsoft SQL Server Management Studio", "C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\SSMS.exe", 2) | |
#Y::OpenOrRun("ahk_exe pycharm64.exe", "C:\Program Files\JetBrains\PyCharm 2018.3.5\bin\pycharm64.exe", 2) | |
#W::OpenOrRun("ahk_exe WINWORD.EXE", "C:\Program Files (x86)\Microsoft Office\root\Office16\WINWORD.EXE", 2) | |
#V::OpenOrRun("ahk_exe iexplore.exe", "C:\Users\mr\MJP Healthcare Innovations LLC\Episode System - Documents\General\Operating System\using flows 10_1_19 mp.vsd", 2) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; app-specific scripts | |
#Include Autohotkey\chrome.ahk | |
#Include Autohotkey\SSMS.ahk | |
#Include Autohotkey\tooltips.ahk | |
#Include Autohotkey\notepad++.ahk | |
#Include Autohotkey\explorer.ahk | |
#Include Autohotkey\ableton.ahk | |
; #Include Autohotkey\clipboard.ahk | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; general functions | |
SwitchDesktop(desktop) | |
{ | |
KeyWait LCtrl | |
if (desktop = 1) { | |
SendInput #^{Left} | |
} | |
else if (desktop = 2) { | |
SendInput #^{Right} | |
} | |
} | |
OpenOrRun(title, exe, desktop) | |
{ | |
; note: the desktop parameter is setup for 2 virtual desktops | |
; if you don't care which desktop the program opens in, pass anything besides 1 or 2 | |
SwitchDesktop(desktop) | |
IfWinExist, %title% | |
{ | |
WinActivate | |
ToolTipTimeout(title, -2000) | |
} | |
else | |
{ | |
if (exe != "") { | |
Run, %exe%,, UseErrorLevel | |
If ErrorLevel | |
{ | |
Msgbox, Exe %exe% not found. | |
Return | |
} | |
WinActivate | |
ToolTipTimeout(exe, -2000) | |
} | |
} | |
} | |
ToolTipTimeout(msg, timeout) | |
{ | |
ToolTip, %msg% | |
SetTimer, RemoveToolTip, -1000 | |
} | |
RemoveToolTip: | |
{ | |
ToolTip | |
return | |
} |
This file contains hidden or 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
#If WinActive("ahk_exe chrome.exe") | |
; ctrl-shift-c to copy the current URL minus all of the url params | |
^+c:: | |
Send, {F6} | |
Send, ^c | |
url := clipboard | |
simplified := StrSplit(url, "?").1 | |
clipboard := simplified | |
ToolTipTimeout(clipboard, -1000) | |
return | |
#if |
This file contains hidden or 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
#If WinActive("ahk_exe Explorer.EXE") | |
; Older versions of explorer had this right -- just goto the address bar and highlight everything | |
F4::AddressBar("") | |
; Shortcuts to predefined locations | |
^D::AddressBar("%UserProfile%\Documents") | |
^+D::AddressBar("%UserProfile%\Downloads") | |
^1::AddressBar("D:\OneDrive") | |
F1::AddressBar("D:\OneDrive") | |
^O::AddressBar("%UserProfile%\MJP Healthcare Innovations LLC\Episode System - Documents\General\Operating System") | |
^R::AddressBar("%UserProfile%\source\repos") | |
^+C::GetFilePath() | |
#if | |
AddressBar(target) | |
{ | |
; Navigate to the address bar and select all | |
; if a target is provided, replace with the target and hit enter | |
Send, !D | |
if (target != "") | |
{ | |
send, %target% | |
send, {Enter} | |
} | |
return | |
} | |
GetFilePath() | |
{ | |
; Copy any file or folder's full path to the clipboard | |
Send,^c | |
ClipWait,1 | |
Clipboard:=Clipboard | |
ToolTip, %Clipboard% | |
SetTimer, RemoveCapsTip, 1000 | |
return | |
} |
This file contains hidden or 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
#If WinActive("ahk_exe notepad++.exe") | |
; map ctrl-w to word-wrap | |
^w:: | |
Send !V | |
Send W | |
Return | |
; map ctrl-f4 to close | |
^F4:: | |
Send ^w | |
Return | |
^+C:: | |
Send ^C | |
Clipboard := RegExReplace(Clipboard, "\?.*", "") | |
msgbox, Clipboard | |
Return | |
#If |
This file contains hidden or 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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; SQL Server Management Studio | |
#If WinActive("ahk_exe ssms.exe") | |
; F4 normally = properties | |
; I sometimes hit it when I mean to hit F5 | |
; I never hit it and mean to bring up properties | |
; So I'm overriding it | |
; use this if you have RedGate SQLPrompt | |
F4::Send +{F5} | |
; otherwise this works for one-liners: | |
; F4::Send {Home}+{End}{F5} | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; simple text substitutions | |
::ss::SELECT * FROM | |
::s10::SELECT TOP 10 * FROM | |
::die::DROP TABLE IF EXISTS | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; custom code blocks | |
::ifb:: | |
Send If /**/ BEGIN | |
Send {Return 2} | |
Send END ELSE BEGIN | |
Send {Return 2} | |
Send END | |
Return | |
::makecursor:: | |
Send DECLARE READER CURSOR FOR SELECT | |
Send {Return} | |
Send OPEN READER | |
Send {Return} | |
Send FETCH NEXT FROM READER INTO @ | |
Send {Return} | |
Send WHILE @@FETCHSTATUS = 0 BEGIN | |
Send {Return} | |
Send {Tab}PRINT @ | |
Send {Return} | |
Send FETCH NEXT FROM READER INTO @ | |
Send {Return} | |
Send +{tab} | |
Send END | |
Send {Return} | |
Send CLOSE READER | |
Send {Return} | |
Send DEALLOCATE READER | |
Send {Return} | |
Return | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; interactive helpers for writing common statements | |
::groupby:: | |
InputBox, ColumnName, ColumnName, Please enter a column name., , 240, 240 | |
InputBox, TableName, TableName, Please enter a table name., , 240, 240 | |
Send SELECT %ColumnName%, COUNT(*) FROM %TableName% GROUP BY %ColumnName% | |
Send {Home}+{End}{F5} | |
Return | |
::colnames:: | |
InputBox, TableName, TableName, Please enter a table name., , 240, 240 | |
Send SELECT column_id, name FROM sys.columns where OBJECT_ID = OBJECT_ID('%TableName%') | |
Send {Home}+{End}{F5} | |
Return | |
#if |
This file contains hidden or 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
::mrr::[email protected] |
This file contains hidden or 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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; tooltips for lock keys | |
; borrowed from chaz: https://autohotkey.com/board/topic/65011-on-screen-key-state-indicator-simple/ | |
~*CapsLock:: | |
Sleep, 10 ; Drastically improves reliability on slower systems (this took me a long time to figure out). | |
ToolTip, % "Caps Lock: " (GetKeyState("CapsLock", "T") ? "ON" : "OFF") | |
SetTimer, RemoveCapsTip, 1000 | |
return | |
~*ScrollLock:: | |
Sleep, 10 ; Drastically improves reliability on slower systems (this took me a long time to figure out). | |
ToolTip, % "Scroll Lock: " (GetKeyState("ScrollLock", "T") ? "ON" : "OFF") | |
SetTimer, RemoveCapsTip, 1000 | |
return | |
~*NumLock:: | |
Sleep, 10 ; Drastically improves reliability on slower systems (this took me a long time to figure out). | |
ToolTip, % "Num Lock: " (GetKeyState("NumLock", "T") ? "ON" : "OFF") | |
SetTimer, RemoveCapsTip, 1000 | |
return | |
RemoveCapsTip: | |
SetTimer, RemoveCapsTip, Off | |
ToolTip | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment