Prefix Words With AutoHotKey

Ever needed to prefix many variable names? Here’s the solution.

Watch part of this short video real quick to see what the following code is used for:

So, what’s happening in the video? I recently had a long list of variables, and using a simple key command, I add a prefix to the variable names and capitalize the entire variable name as a best practice, because it is a constant. For all of the work shown on-screen, I only used a simple key command over and over. Here’s the entire AutoHotKey code that I used.

; Add prefix and capitalize work
    Sleep, 300
    ;; Double-click
	MouseGetPos X,Y
	Send {Click  %A_CaretX%,%A_CaretY% 2}
	MouseMove (X),(Y)
    Sleep, 20
    ; Go to left of word
    Send {Shift Down}{Ctrl Down}x{Ctrl Up}{Shift Up}{Left}
    ; Add prefix
    Send TAG_{Down}

Check out my other AutoHotKey cheat sheets:
- Stringify Variables with AutoHotKey

Danial Goodwin -
Computer Engineer | Co-Founder and Lead Developer for Simply Advanced, LLC

One Response to “Prefix Words With AutoHotKey”

  1. [...] Check out my other AutoHotKey cheat sheets: – Prefix Words with AutoHotKey [...]

Leave a Reply

You must be logged in to post a comment.