Insert Text (anywhere) With a Shortcut

If you find yourself repeatedly typing the same thing over and over again, this is for you!

There are a few commercial app that can do text replacement, but this is free! We can create a Service which when activated with a keystroke will paste the text into any application.

This means you can assign a piece of text to a keyboard shortcut which, when pressed, will appear in any text box, field or place that can accept text. We'll be using Automator to create the service workflow, then set a shortcut to it.

Create The Service

Open Automator in your Applications folder. When the menu pops up select the Service option. On the left-pane locate the Run Applescript action and drag it to the right-pane.

Change drop-down boxes at the top where says Service receives to no input and in to any application.

Delete the sample code and type this:

on run
tell application "System Events"
keystroke "This is my automated text"
end tell
end run

If the text has multiple lines use:

on run
tell application "System Events"
keystroke "This is my automated text. The first line"
keystroke return
keystroke "This is my automated text. The other line"
end tell
end run
Shortcut key

Now save the workflow with some short name, something that will help you know what the service is for.

Assigning a Shortcut

Now we have to create the shortcut that will call this Automator workflow and add text to any text box or field when selected. Follow these steps:

  1. Open System Preferences and select the Keyboard. Select the Shortcuts tab and select the Services menu option from the left-hand list.

  2. Scroll down to the ‘Text’ options within the list on the right. Here you will find the services you have just created, select the line and click on the button on the right that says add shortcut. Press the shortcut you wish to set. Try not to use a shortcut that is already in use, such as CMD + C !

Shortcut System

That's it! Now place the cursor some box or app where you can type, and press the shortcut. The text you've set inside the Automator workflow will be typed for you.

{{ message }}

{{ 'Comments are closed.' | trans }}