Auto keystrokes

with AutoHotkey

by Denis Lamarre
last updated Jul 11, 2013
difficulty.png Easy

by Denis Lamarre


Automatically type commonly used sequences of numbers and letters without error. From account numbers to department and product numbers, phone numbers and credit card information to canned answers, this is a super easy and useful script that can be done with AutoHotkey.

Using the AHK Enterpad labeled soft buttons provides a more practical and reliable approach than Windows hotkeys to trigger plenty of these short AutoHotkey scripts.

Note: AutoHotkey has no limits when it comes to automation in Windows, but for many users who may only need simple keyboard shortcuts, installing and learning AutoHotkey, and keeping up to date, can be overkill. ShortKeeper can be used (with and without an Enterpad) to manage an AutoHotkey-based system in a way most non-programmers will find remarkably user-friendly and and effective [learn more].

Let’s start with something simple like a script that types a credit card number. Don’t miss the following “More Info” section that will show you how to cope with different situations.



stencil-v4b-keystroke.gifPrepare your overlay
Choose a free key on the Enterpad that can be used to type a credit card number. Name it something relevant. This example uses "Credit Card".


Code installation
Copy/paste the following script in your AutoHotkey script template (Enterpad.ahk) at the chosen key location. Replace the sample credit card number (0000 0000 0000 0000) with something valid.

SendInput 0000 0000 0000 0000

More Info

The AutoHotkey documentation provides a lot of information about the SendInput (and other similar) commands at:

The SendInput information is useful in many ways. For instance:

The SendInput command has a special {raw} mode to send keystrokes exactly (with few exceptions) as they appear rather than translating {Enter} to an ENTER keystroke, ^c to Control-C, etc. As an example, the following command will send the two following characters ^c instead of doing control+c.

SendInput {raw}^c

If you are not using the {raw} mode, you will have to treat/handle the following special characters specially to send them:

Used to retrieve a variable's content. Escape with a backtick like `%
Used to send ALT keystroke. Put within braces like {!}
Used to send SHIFT keystroke. Put within braces like {+}
Used do send CONTROL keystroke. Put within braces like {^}
Used to send WIN keystroke. Put within braces like {#}
Put within braces like {{}
Put within braces like {}}
Escape like `; or within braces like {;} only if the semicolon has a space or tab to its left
Escape the backtick with a backtick like ``

As you may have noticed, there is no comma in the list above. While a comma may be a special character in AutoHotkey, it is not used as a special character with the SendInput command. This is because there is only one parameter to the SendInput command. There is no need to separate paramaters with commas. So the use of commas inside the keystrokes to send will be typed just as it is by AutoHotkey.

As an example with a special character; If you would like to type 25% you can use one of the following commands:

SendInput 25`%


SendInput {raw}25%