Created
July 24, 2016 15:05
-
-
Save nmpowell/bbd0ef0db7d607ee1b252a9b0f55f3a9 to your computer and use it in GitHub Desktop.
Some Autohotkey shortcuts
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
; Some Autohotkey shortcuts I use | |
#NoEnv | |
SetWorkingDir %A_ScriptDir% | |
GroupAdd, Explore, ahk_class CabinetWClass | |
GroupAdd, Explore, ahk_class ExploreWClass | |
SetTitleMatchMode, 2 | |
; load many useful global variables | |
LoadVariables() | |
; Quick text for Current time and date | |
; ------------------------------------ | |
; Reference: | |
; ]dts 20160614 - Tue, 12:18 PM | |
; ]dtl 2016-06-14 - Tuesday, 12:18 PM | |
; ]da 20160614 | |
; ]ds 20160614 - (for filenames) | |
; ]df 2016-06-14 | |
; ]dd 2016-06-14, Tuesday (also, MarkDown heading: ##dd: ## 2016-06-14, Tuesday) | |
; ]dv Tuesday 14 June 2016 | |
; ]do Tuesday, 14th June 2016 (formal-ish; check 'th / nd / st') | |
; ]dn -- Nick (\n) Tuesday, 14th June 2016 | |
:*:]dts:: ; Timestamp: 20120504 - Fri, 12:12 PM | |
FormatTime, ts,, yyyyMMdd - ddd, hh:mm tt | |
SendInput, %ts% | |
Exit | |
:*:]dtl:: ; Friendly timestamp: 2016-07-08 - Friday, 11:16 AM | |
FormatTime, ts,, yyyy-MM-dd - dddd, hh:mm tt | |
SendInput %ts% | |
Exit | |
:*:]da:: ; Date alone: 20120504 | |
FormatTime, ts,, yyyyMMdd | |
SendInput %ts% | |
Exit | |
:*:]ds:: ; Save Date eg: 20111220 - [Type File Name] | |
FormatTime, ts,, yyyyMMdd | |
SendInput %ts% -{Space} | |
Exit | |
:*:]df:: ; Friendly date: 2012-05-04 | |
FormatTime, ts,, yyyy-MM-dd | |
SendInput %ts% | |
Exit | |
:*:]dd:: ; Full friendly date (with day): 2012-05-04, Friday | |
FormatTime, ts,, yyyy-MM-dd, dddd | |
SendInput %ts% | |
Exit | |
:*:]dv:: ; Very friendly date: Sunday 04 March 2014 | |
FormatTime, ts,, dddd dd MMMM yyyy | |
SendInput %ts% | |
Exit | |
:*:]do:: ; Formal friendly date: Sunday, 4th March 2014 | |
FormatTime, day,, dddd | |
FormatTime, date,, d | |
FormatTime, month,, MMMM | |
FormatTime, year,, yyyy | |
suffix := NatSuf(d) | |
SendInput %day%, %date%%suffix% %month% %year% | |
Exit | |
:*:]dn:: ; Signature with Formal friendly date: -- Nick // Sunday, 4th March 2014 | |
FormatTime, day,, dddd | |
FormatTime, date,, d | |
FormatTime, month,, MMMM | |
FormatTime, year,, yyyy | |
suffix := NatSuf(d) | |
SendInput -- Nick{Enter}%day%, %date%%suffix% %month% %year% | |
Exit | |
; Some MarkDown | |
:*:##dd:: ; ## 2016-06-14, Tuesday | |
DateStampMarkDownTitle2() | |
Exit | |
DateStampMarkDownTitle2() { | |
FormatTime, ts,, yyyy-MM-dd, dddd | |
SendInput {# 2}{space}%ts% | |
Return | |
} | |
; Rename shortcut: prepend the date to a filename: "20160708 - ", if Explorer is active. | |
!F2:: | |
IfWinActive ahk_class CabinetWClass | |
{ | |
FormatTime, ts,, yyyyMMdd | |
SendInput {F2}{Home}%ts% -{Space}{Enter} | |
} | |
Exit | |
; Format numbers or dates with the appropriate suffix (st, nd, rd, th) | |
; Below is from http://www.autohotkey.com/board/topic/55892-is-there-an-algebraic-formula-for-adding-number-suffixes/?p=351148 (Thanks!) | |
NatSuf( n ) { | |
Return Mod( n, 10 ) = 1 ? ( Mod( n, 100 ) = 11 ? "th" : "st" ) : Mod( n, 10 ) = 2 ? ( Mod( n, 100 ) = 12 ? "th" : "nd" ) : Mod( n, 10 ) = 3 ? ( Mod( n, 100 ) = 13 ? "th" : "rd" ) : "th" | |
} | |
; Complete underlines! (place cursor at the end of the line to be underlined) | |
; Typing "Heading]]=" produces, e.g.: | |
; Heading | |
; ======= | |
:*?:]]-:: | |
CompleteUnderline("-") | |
Exit | |
:*?:]]=:: | |
CompleteUnderline("=") | |
Exit | |
:*?:]]~:: | |
CompleteUnderline("~") | |
Exit | |
CompleteUnderline(symbol) { | |
ClipSave = %Clipboard% | |
Clipboard = | |
SendInput, {End} | |
Sleep, 10 | |
SendInput, +{Home} | |
Sleep, 10 | |
SendInput, ^c | |
ClipWait | |
Sleep, 20 | |
StringLen, linelength, Clipboard | |
Clipboard = %ClipSave% | |
SendInput, {End} | |
Sleep, 10 | |
SendInput, {Enter} | |
Sleep, 10 | |
Loop %linelength% | |
{ | |
SendInput, %symbol% | |
} | |
Sleep, 20 | |
SendInput, {Enter} | |
Sleep, 20 | |
Return | |
} | |
; Special characters | |
; bullets: left Alt + 7 •, 8 °, 9 ○ | |
LAlt & 7::SendInput, {ALTDOWN}{Numpad7}{ALTUP}{Tab} | |
LAlt & 8::SendInput, {ALTDOWN}{Numpad0}{Numpad1}{Numpad7}{Numpad6}{ALTUP} | |
LAlt & 9::SendInput, {ALTDOWN}{Numpad9}{ALTUP}{Tab} | |
LAlt & y::SendInput, {Home}✓{Tab}{End} | |
:*:-..::•{Tab} | |
:*?:]]u::{µ} ; micro symbol (or {Asc 0181}) | |
:*?:]]s::{§} ; section symbol | |
:*?:]]b::{β} ; Beta symblol |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment