Ever needed to make many Strings based off of variable names? Here’s the solution.

Watch this 13 second video real quick to see what the following code is used for: http://www.youtube.com/watch?v=1JxEiZ9nIsg
Stringify Variables With AutoHotKey

So, what’s happening in the video? I recently had a long list of variables, and using a simple key command, I turn the variable name into a String and more. For all of the work shown on-screen, I only used a simple key command over and over. Though, I could have made my basic AutoHotKey a lot more sophisticated. Here’s the entire AutoHotKey code that I used. The only reason for the Sleep/wait functions is because AutoHotKey was sending the commands too fast to process.

; Press WindowsKey + t to select word cursor is on,
; then add String suffix with variable name in it.
    Sleep, 300
    ; Double-click
	MouseGetPos X,Y
	Send {Click  %A_CaretX%,%A_CaretY% 2}
	MouseMove (X),(Y)
    Sleep, 20
    ; Copy
    Send {Ctrl Down}c{Ctrl Up}
    Sleep, 40
    ; Paste
    Send {Ctrl Down}v{Ctrl Up}
    Sleep, 40
    ; Move to end of line, behind semi-colon
    Send {End}{Left}
    ; Prefix with ` = ""`
    Send {Space}={Space}""
    ; Move inside quotations
    Send {left}
    ; Paste
    Sleep, 20
    Send {Ctrl Down}v{Ctrl Up}
    Sleep, 40
    ; Prepare for next copy-paste
    Send {Down}{End}{Left}{Left}

- After first copying word, instead of pressing {End}{Left}, I probably could have just send {Right} to move the cursor to the right.
- AutoHotKey might send commands faster than Windows can process them, so the system waits with the `Sleep, \` command. You may need more system pauses (or not). - There probably is a way to slow down the entire AutoHotKey program, but I didn’t feel like looking that up yet. If you know how, please let me know. ;]

Check out my other AutoHotKey cheat sheets:
- Prefix Words with AutoHotKey

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