Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@coderofsalvation
Last active October 27, 2019 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coderofsalvation/e56363785e401e111135835096fc10bf to your computer and use it in GitHub Desktop.
Save coderofsalvation/e56363785e401e111135835096fc10bf to your computer and use it in GitHub Desktop.
easiest autohotkey text-expansion using textfiles for windows

Install

  • install autohotkey
  • put this script in a folder with a bunch of textfiles
  • add a shortcut to the .ahk-file to the startup-folder

profit!

; typing 'foo ' will expand foo.txt
; typing '/bar' will expand _bar.txt
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Loop *.txt
{
tag:= "::" + StrReplace(A_LoopFileName, ".txt")
tag:= StrReplace(tag,"_","`/")
FileRead, txt, %A_LoopFileName%
HotString(tag,"{Raw}"+txt)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment