Insert Text With A Keystroke or Shortcut In Any Application 0

Trick

Share
Insert Text With A Keystroke or Shortcut In Any Application

Hey,

If you find yourself repeatedly typing the same thing over and over again you will want a better solution. You could copy the data to the clipboard, but this is quickly forgotten when you copy something new. To get around this problem 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 short cut which, when pressed, will appear in any text box, field or place that can accept text. This can save a lot of time.

Create The Service To Add Text

The first step is to create a Service. This will do what we want. The service will essentially tell your Mac that it wants to type a piece of text.

To create the Service, open Automator in your Applications folder. When the menu pops up select the service option. This will a lot of the hard work of creating this type of trick for us.

Create a new service within Automator.

Create a new service within Automator.

When the page has been selected change the settings at the top of the workflow so the Service receives ‘no input’ and is available in ‘any application.

Find the AppleScript pane from the library and drag it into the workflow. Insert the following text into the text box. Press the hammer button to compile the text.

on run
tell application "System Events"
keystroke "This is the text that will appear"
end tell
end run

Change the text within the double quote marks to anything you want.

Use the Applescript pane to do the work.

Use the Applescript pane to do the work.

Save the Service and give it an appropriate name.

Assign A Shortcut

We now have created a shortcut that will add text to any text box or field when selected. This is a simple process which I have covered before.

Open System Preferences and select the keyboard preference pane. Open the keyboard shortcuts tab and select the Services menu option from the left hand list. Scroll down to the ‘General’ option within the list on the right. Here you will find the service you have just created. Click on the button that says ‘add shortcut’. Select the shortcut you wish to select.

Use System Preference to add a keyboard shortcut.

Use System Preference to add a keyboard shortcut.

Now when you go to the Service menu from within any application that has a text box or field, you can select the option from the menu or you can use the new shortcut you have just created.

The Service option we created can now insert text with a keyboard shortcut.

The Service option we created can now insert text with a keyboard shortcut.

Conclusion

This is a simple trick which doesn’t take long to set up. You have to create a service for each piece of text you want to use. You also have to find a keyboard command or shortcut that isn’t taken.

It is very useful if you find yourself typing the same piece of text over and ver again. For example a web address or email.


If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.

Where To Next?

  • Subscribe To Mac Tricks And Tips