Skip to content

Instantly share code, notes, and snippets.

@hamishnorton
Last active December 2, 2018 04:12
Show Gist options
  • Save hamishnorton/00b6accfcb1eb51e0a61b7dcc63cf113 to your computer and use it in GitHub Desktop.
Save hamishnorton/00b6accfcb1eb51e0a61b7dcc63cf113 to your computer and use it in GitHub Desktop.
Auto Hot Key Lauchers and Expanders
#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.
SetNumLockState, AlwaysOn
SetCapsLockState, AlwaysOff
SetScrollLockState, AlwaysOff
Return
; Restart Script: Ctrl + Alt + R
^!r::Reload
Reload
Sleep 1000 ; If successful, the reload will close this instance during the Sleep, so the line below will never be reached.
MsgBox, 4,, The script could not be reloaded. Would you like to open it for editing?
IfMsgBox, Yes, Edit
Return
; Get ClassName Shift + F12
+F12::
WinGetClass, class, A
MsgBox, The active window's class is "%class%".
Return
; ============================= Re-purposed keys =============================
; Minimize Current Window Capslock
Capslock::WinMinimize,A
Return
; Search Google for the Selected Text Insert
Insert::
Send ^c
ClipWait 0.2
Run http://www.google.com/search?q=%clipboard%
Return
; Paste ScrollLock
;ScrollLock::^v
;Return
; Paste PrintScreen
;PrintScreen::^v
;Return
; Paste PrintScreen
;Pause::^v
;Return
; This doesn't seem to work...
; Paste NumLock
;NumLock::^v
;Retrun
; ================================= Launchers =================================
; Open as Administrator Ctrl + Windows + <hotkey>
; Open Windows + <hotkey>
; When Window + <hotkey> isn't available Ctrl + Alt + <hotkey>
; Game Bar (Windows - built in) Winows + G (overriden below)
; Settings (Windows - built in) Winows + I
; Lock (Windows - built in) Winows + L (Can not be overriden)
; Display Projection Options (Windows - built in) Winows + P
; Display Settings (Windows - built in) Winows + U (Can not be overriden)
; Command Prompt (as Administrator) Ctrl + Alt + P
XButton1 & p::
XButton2 & p::
^#p::
Run *RunAs Cmd
Return
; Visual Studio Code (as Administrator): Ctrl + Alt + C
^#c::
Run *RunAs Code
Return
; Visual Studio Code: Win + C
XButton1 & c::
XButton2 & c::
#c::
Run Code
Return
; FireFox Win + F
#f::
XButton1 & f::
XButton2 & f::
Run Firefox
Return
; Chrome Win + G
XButton1 & g::
XButton2 & g::
#g::
Run Chrome
Return
; EverNote: Win + N
XButton1 & n::
XButton2 & n::
#n::
Run "C:\Program Files (x86)\Evernote\Evernote\Evernote.exe"
Return
; SourceTree Ctrl + Windows + S (overrides Speech Regcognition)
XButton1 & s::
XButton2 & s::
^#s::
Run "C:\Users\<username>\AppData\Local\SourceTree\SourceTree.exe"
Return
; Visual Studio (as Administrator): Win + V
XButton1 & v::
XButton2 & v::
#v::
Run *RunAs "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe"
Return
; Rider Win + Numpad.
XButton1 & NumpadDot::
XButton2 & NumpadDot::
#NumpadDot::
Run *RunAs "C:\Program Files\JetBrains\JetBrains Rider 2018.2.3\bin\rider64.exe"
Return
; Remote Desktop: Win + Numpad*
XButton1 & NumpadMult::
XButton2 & NumpadMult::
#NumpadMult::
Run %A_WinDir%\system32\mstsc.exe
Return
; ----------------------------- Start Explorer in... --------------------------
; D:\... Ctrl + Numpad1
^!Numpad1::
Run Explorer D:\...
Return
; C:\_working\ Ctrl + Numpad2
^!Numpad2::
Run Explorer C:\_working
Return
; D:\... Ctrl + Numpad3
^!Numpad3::
Run Explorer D:\...
Return
; D:\... Ctrl + Numpad4
^!Numpad4::
Run Explorer D:\...
Return
; D:\... Ctrl + Numpad5
^!Numpad5::
Run Explorer D:\...
Return
; Ctrl + Numpad6
^!Numpad6::
Run Explorer
Return
; Ctrl + Numpad7
^!Numpad7::
Run Explorer
Return
; D:\Microsoft SQL Server\MSSQL14.MSSQLLOCALDB\MSSQL Ctrl + Numpad8
^!Numpad8::
Run Explorer "D:\Microsoft SQL Server\MSSQL14.MSSQLLOCALDB\MSSQL"
Return
; D:\... Ctrl + Numpad9
^!Numpad9::
Run Explorer D:\...
Return
; ----------------------------- Start VS Code in... --------------------------
; D:\... Alt + Numpad1
!Numpad1::
SendInput #r
Sleep 50
SendInput Code -n D:\...
Return
; C:\_working\ Alt + Numpad2
!Numpad2::
SendInput #r
Sleep 50
SendInput Code -n C:\_working
Return
; D:\... Alt + Numpad3
!Numpad3::
SendInput #r
Sleep 50
SendInput Code D:\...g
Return
; D:\repos\... Alt + Numpad4
!Numpad4::
SendInput #r
Sleep 50
SendInput Code -n D:\repos\... {Enter}
Return
; Alt + Numpad5
!Numpad5::
SendInput #r
Sleep 50
SendInput Code
Return
; Alt + Numpad6
!Numpad6::
SendInput #r
Sleep 50
SendInput Code
Return
; Alt + Numpad7
!Numpad7::
SendInput #r
Sleep 50
SendInput Code
Return
; Alt + Numpad8
!Numpad8::
SendInput #r
Sleep 50
SendInput Code
Return
; Alt + Numpad9
!Numpad9::
SendInput #r
Sleep 50
SendInput Code
Return
; ======================= Text Expanders / Hotstrings ========================
; Activated without a trigger ::<hotkeys>::
; Activted with a trigger :*:<hotkeys>::
; triggers are: tab, space, entry
; ---------------------------------- Date Time --------------------------------
; Reverse Date and Short Day ]d
:*:]d::
FormatTime, CurrentDateTime, , yyyy-MM-dd, ddd
SendInput %CurrentDateTime%
return
; 24hr Time ]t
:*:]t::
FormatTime, CurrentDateTime, , HH:mm:ss
SendInput %CurrentDateTime%
return
; UTC Date and Time 'dt
:*:'dt::
FormatTime, CurrentDateTime, , yyyy-MM-dd'T'HH:mm:ss
SendInput %CurrentDateTime%
return
::qd::
FormatTime, CurrentDateTime, , yyyy-MM-dd'T'HH:mm:ss
SendInput "datetime": "%CurrentDateTime%"
Return
; ------------------------------- Email Addresses -----------------------------
; hamish@h... @h
::@h::
SendInput hamish@...
Return
; hamish@... @6
::@6::
SendInput hamish@...
Return
; hamish@... @G
::@G::
SendInput hamish@...
Return
; ------------------------------------- Text ----------------------------------
; sweet as sa
::sa::
SendInput sweet as
Return
; no wories nw
::nw::
SendInput no worries
Return
; ToDo: td
::td::
SendInput ToDo:{space}
Return
; - DONE -d
::-d::
SendInput - DONE
Return
::qe::
SendInput "event": {{}
Return
; ------------------------------- C# & JavaScript ----------------------------
; // ToDo: 'td
::'td::
SendInput // ToDo:{space}
Return
; // Warning: 'wn
::'wn::
SendInput // Warning:{space}
Return
; // Question: 'q
::'q::
SendInput // Question:{space}
Return
; // Thought: 't
::'t::
SendInput // Thought:{space}
Return
; ----------------------------------- MarkDown --------------------------------
; Copies selected text as the URL portion of a Markdown-formatted hyperlink
; Asks for the text to display for the link
; Places the link as follows in the clipboard [text](url)
^!c::
;Clipboard :=
SendInput ^c
MDurl = %Clipboard%
MDtext = %Clipboard%
IfNotInString, MDurl, ://
MDurl = http://%MDurl%
Gui, +AlwaysOnTop +Owner
Gui, Add, Text,, Text to display
Gui, Add, Edit, vMDtext w320 r1, %MDtext%
Gui, Add, Text,, URL
Gui, Add, Edit, vMDurl w320 r1, %MDurl%
Gui, Add, Button, Default, OK
Gui, Show, w350, MDLink
Return
^Insert::
SendInput ^c
ClipWait 0.2
MdTitle = %Clipboard%
SendInput [%MdTitle%]()
Return
!Insert::
SendInput ^c
ClipWait 0.2
MdUrl = %Clipboard%
SendInput [](%MdUrl%)
Return
; ------------------------------------ Paths ---------------------------------
; ProgramFiles Path pf\
:*:pf\::
Send %A_ProgramFiles%
Return
; ============================= Explorer Specific =============================
; if I put things after this they don't seem to work
#IfWinActive ahk_class CabinetWClass
^#p::
Send !d Cmd {enter}
Return
XButton1 & c::
XButton2 & c::
#c::
SendInput !d
Clipboard =
SendInput ^c
ClipWait 0.2
path = %Clipboard%
SendInput #r
Sleep 50
SendInput Code -n %path% {Enter}
Return
#IfWinActive ;maybe this will allow things to work after it?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment