Photo by Alex Knight on Unsplash

Using Automator to Insert text with a Shortcut Key on Mac

A step by step guide

Srinivas Gurlinka
Published in
3 min readDec 9, 2019

--

As a developer, I have to remember and enter multiple credentials on a daily basis for different services. I searched for tools which can enter the text of my choice linked to a shortcut key. I have come across a way to do it without any 3rd party tools and MacOS provides this by default using ‘Automator’

How to Open and Configure Automator

Search for Automator and click on it.

File > New > Select “Quick Action” > Choose

Search for “Run AppleScript” and drag & drop on to the right pane

Update the script like below:

on run {input, parameters}    tell application "System Events" to keystroke "abc@xyz.com"    return inputend run

You can replace the text in the ‘keystroke’ to whatever you like to add.

File > Save… > Give a name > Save

This completes the configuration on Automator. The next step is to assign a Shortcut for the action that we have defined.

How to Assign a Shortcut

Open “System Preferences” > Keyboard > Shortcuts Tab > Services. You should see the service that you have just created.

Click on the service and click on “Add Shortcut” and assign a shortcut.

Now the service will be invoked every-time you hit the shortcut and the service would enter the keystrokes “abc@xyz.com”.

How to use it

You can hit the keystrokes you have assigned in the previous step to invoke the action. However the first time you try to use it in any application, you’d get a system message like below. Click on “Ok”

Next, you’ll see 2 more pop-ups. On the 2nd pop-up clock on “Ok”. Then click on “Open System Preferences” in the 1st pop-up.

Check the box corresponding to the application in which you are trying to use.

Once checked, you should be able to use the shortcut in the application you have selected. You would have to repeat this step for every application for the first time you are using this feature in it.

Note: It is not advisable to use this process for passwords as it exposes the passwords to anyone who has access to your Mac. If you still plan on using this for passwords like me, please be cautious.

Hope this helps.

This is my first article on Medium. Any feedback is appreciated.

--

--