How To Template Anywhere | Free AHK Text Expansion Script



This one is slightly advanced: if you're working in a tool that doesn't offer templates *cough* Roam *cough* then text expansion can cover a lot that gap for you.

Credit to Nat Eliason who gave me the idea (it's in his very solid Roam course).

Nat suggested textexpander.com which seems solid. Since I'm not on iPhone, and it won't sync between windows and android, I couldn't get myself to spend on the $5 monthly, reasonable as it is.

Disclaimer: I might just be being silly about the whole thing, but, if you're stuck on it like I am, you can use AutoHotKey which, admittedly I already had installed, so I was partway there.

All I was missing what the Textexpander script linked below.

If you're already using AHK, then the setup is simple, just follow the instructions linked below.

If you're new, then setup is still pretty simple but be warned that there's a little learning curve because it's still a programming language, though you will be able to find most of what you need pre-made.

Side perks: Among other things, AHK lets you pretty well remap or automate your keyboard. Change what a key does, make custom shortcuts, way more.

I'm not doing it justice here but I originally got it because my laptop doesn't have a right Ctrl button which is insane, so I changed what one of the keys does to create one.



Here is a script from Brain co-students Erik Newhard and Twishmay Shankar. As soon as their sites are we'll move this over there, but for now👇🏼. Also, the instructions are below.

#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.



ExpandTextThroughClipboard(text)
{
 old := ClipboardAll
 Clipboard := text
 send ^v
    sleep 150
 Clipboard := old
    old =
}



;ROAM TEMPLATES

; Article

::~rmart::
template=
(
Author:: 
Link:: 
Tags:: #Articles 
)
ExpandTextThroughClipboard(template)
return



; Book

::~rmbk::
template=
(
Author::
Recommended By::
Links::
 Amazon::
 Goodreads::
Tags:: #Books
)
ExpandTextThroughClipboard(template)
return

Setup instructions:


  1. Copy the text above into notepad and save it
    1. as TextExpander.AHK 
    2. in the startup folder (so it will start on boot). Type "startup" in the navigation bar to get there. 
  2. Replace the text between the ::'s with the shortcut keys you would like to use (in this case ~rmbk is what you would be replacing)
  3. replace the text between the brackets with your own templates (which you can paste in from Roam or wherever else
To insert a template somewhere, type the shortcut followed by the spacebar.

That should be it!





Comments

Popular posts from this blog

Todoist & PARA - Effortless Personal Task Management; Setup and Routines

Designing the Future of Work | What I learned as a Flow Manager

How to Get Out of Our Heads | 🧠💗🦸‍♂️ Our 3 Intelligences