MacOS – Automatically Inserting Text Globally

keyboardmacmacosshortcut-menu

Let's say I want this action to happen on any program whenever I press F10 (or some other custom key combination):

Paste the text: "Hello World!"

There's a similar tool in Windows called AutoHotKey but apparently it doesn't have a Mac equivalent.

Any idea how to achieve this on Mac?

Best Answer

Using Automator :

  • Create a new Service with automator
  • Select Service receives selected no input in any application
  • Add a Run AppleScript action

Copy this script :

on run {input, parameters}
  tell application "System Events"
    keystroke "Text to type"
  end tell
end run
  • Save your new service
  • In System Preferences > Keyboard > Keyboard Shortcuts > Services add a keyboard shortcut to your news ervice

NB: Replace "Text to type" by the text you want to add. Typing it will for example use directly the current style in apps like Word etc.