Auto keystrokes

with AutoHotkey

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

by Denis Lamarre


Automatically insert commonly used text, such as addresses, phone numbers, account numbers, credit card information, and more. This is a super easy and useful keyboard shortcut that you can run with AutoHotkey. The AHK Enterpad, with its assignable buttons and customizable overlay, provides a more practical and reliable approach than hotkeys when using multiple shortcuts like this.

To create a simple auto keystroke shortcut that will type in a credit card number, just follow the steps below. Don’t miss the “More Info” section further down on the page for tips on dealing with specific situations.



stencil-v4b-keystroke.gifPrepare your overlay
Choose an unassigned key on the Enterpad where you will assign the credit card number. Name it something appropriate, like “Credit Card.”


Code installation
Copy and paste the following script in the AutoHotkey script template file “Enterpad.ahk” at the location of the key you wish to assign. Replace the sample credit card number (0000 0000 0000 0000) with that of your choice.

SendInput 0000 0000 0000 0000

More Info

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

SendInput {raw}^c

If you are not using the {raw} mode, you will have to treat the following special characters carefully; they have particular significance in Autohotkey:

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

For example, if you want to automatically insert 25%, you could use one of the following commands:

SendInput 25`%


SendInput {raw}25%

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