How to Automatically Type a Period with a Double Space in Windows

00_lead_image_automatically_typing_a_period

Most smartphones have a feature in which you can double tap the spacebar to insert a period. Wouldn’t it be nice if you could do that on your Windows PC too? We’ll show you how you can.

RELATED: The Beginner’s Guide to Using an AutoHotkey Script

We’re going to create an AutoHotkey script to insert a period followed by a space when you double tap on the space bar. AutoHotkey is a free, open-source program that allows you to automate repetitive tasks in Windows. It uses a scripting language that was originally designed to create keyboard shortcuts, or hotkeys, but it evolved into a scripting language that allows you to automate almost anything—no programming knowledge required.

If you’re curious, check out our beginner’s guide to AutoHotkey to learn more about it. But even if you’ve never used it before, you should be able to follow the steps below easily.

Download AutoHotkey, install it using the Express Installation, and restart your PC. Then, right-click on any empty area of the desktop and go to New > AutoHotkey Script.

01_creating_a_new_autohotkey_script

A file with the extension .ahk is created on your desktop. Rename the file, making sure to keep the .ahk extension. You can also move it wherever you want on your PC—put it in a safe place, because you’ll need to keep the script as long as you want this feature.

Then, right-click on the file and select “Edit Script” from the popup menu.

02_selecting_edit_script

We will use what’s called a “hotstring” to replace two spaces with a period followed by a space. This will work in any program, any time you type two spaces.

When you select Edit Script, the script file you created opens in the default text editor, which in our case is Notepad. There are some lines automatically added to the beginning of the file. Put the cursor at the end and add the following text on a new line. You can just copy and paste the text.

:*:  ::{NumpadDot}{space}

Here’s what this line does:

  • The asterisk (*) between the first pair of colons is an option that indicates an ending character is not required. This means that as soon as you type two spaces, they will be replaced by a period followed by a space.
  • There are two spaces between the next pair of colons. This indicates what you type to insert the replacement text.
  • The pair of colons after the two spaces is just a divider between the activating action (the two spaces) and what the action executes (replacing the two spaces with a period and a space).
  • The items in brackets after the last colon are the characters that will replace the two spaces.

03_entering_autohotkey_command

Press Ctrl+S to save the script file and then click the “X” button in the upper-right corner of the window to close the text editor.

04_closing_notepad

Double-click on the script file to run the script.

05_double_clicking_on_script_file

Now, in any program where you can type text, such as text editors, word processors, and browsers, you can double-tap the space bar to type a period and a space. You may have to test the speed at which you need to double-tap the space bar for this to work.

05a_automatically_typing_a_period

You can edit the script at any time by right-clicking on the script file and selecting Edit Script, just like when you first created the script. You can also edit the script by right-clicking the AutoHotkey icon in the system tray and selecting “Edit This Script” from the popup menu. If you change the script, or add additional actions to it, use the “Reload This Script” option on the popup menu on the system tray icon to run the revised script without having to exit and re-run the script.

06_reloading_script

 

RELATED: How to Make a Program Run at Startup on Any Computer

If you want your AutoHotkey script to run automatically when Windows starts, you can create a shortcut and put that shortcut in the Startup folder. Right-click on the .ahk script file and select “Create shortcut” from the popup menu.

09_selecting_create_shortcut

Select the new shortcut and press Ctrl+C to copy it.

10_copying_shortcut

Press Windows+R on your keyboard to open the Run dialog box, type shell:startup in the Open box, and click “OK” to open the Startup folder.

NOTE: When you add a shortcut to the shell:startup folder, it will only launch when you are logged into the current account. If you want the shortcut to launch whenever any user logs in, type shell:common startup in the Open box on the Run dialog box.

11_opening_startup_folder

Press Ctrl+V to paste the shortcut into the Startup folder. Now, your AutoHotkey script will always run when Windows starts and you’ll be able to type two spaces to insert a period followed by a space.

12_autohotkey_script_in_startup

Again, to learn more about using scripts in Windows with AutoHotkey, read our beginner’s guide to using an AutoHotkey script.

Lori Kaufman is a writer who likes to write geeky how-to articles to help make people's lives easier through the use of technology. She loves watching and reading mysteries and is an avid Doctor Who fan.