Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question
    
Creating a service with Automator then bind it to a keyboard short cut could be an a solution –  Matthieu Riegler Apr 6 '13 at 13:59
    
Matt, actually I've been considering Automator but I've never really understood how it works. Any idea how I can achieve this there? –  Ronixus Apr 6 '13 at 14:42
    
See my answer below. I gave the full procedure to create such services and you them with the keyboard. –  Matthieu Riegler Apr 6 '13 at 18:39
    
Got it. Thanks Matt. Accepted answer. :) –  Ronixus Apr 7 '13 at 4:00

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer

There is no option integrated into MacOS, but I think the software TextExpander is doing what you are asking for. You can specify shortcuts like "adr" to paste your whole address for example.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.