Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How do I program my Mac's F19 key to automatically type a text when I press it?

share|improve this question

2 Answers 2

You could also create ~/Library/KeyBindings/ and save a property list like this as DefaultKeyBinding.dict.

{
    "\UF716" = (insertText:, "test");
}

Applications have to be reopened to apply changes. For more information, see http://www.hcs.harvard.edu/~jrus/Site/Cocoa%20Text%20System.html or http://lri.me/keybindings.html.

share|improve this answer

If you want to use any keyboard shortcut, with built-in methods …

Open up Automator.app and create a new Service. Set it to receive no input and drag Run AppleScript from the left pane to the right.

Enter this script:

tell application "System Events"
    keystroke "your-text.com"
end tell

Save the service under any name you like. Normally, you'd assign shortcuts to services by going to System Preferences » Keyboard » Keyboard Shortcuts. Here, you can assign (almost) any key combination.

However, in OS X 10.6, there's a bug that won't let you assign a service to an F-key. See the second option in my answer on how to overcome that. In 10.7 it seems to work though.


If you want to use third-party software …

Open up AppleScript Editor.app and paste the script from above. Save it under ~/Library/Scripts. You need to create this folder before if it doesn't exist. If your Library is hidden, in Finder press CmdShiftG and enter ~/Library to view it.

Then, after you've saved the script, you can install FastScripts and bind that script to F19 (or whatever you like).

enter image description here

share|improve this answer
    
10.7.4 seems to allow using just F-keys as shortcuts for services. –  Lri Jun 24 '12 at 16:18
    
Good to know they've resolved this. –  slhck Jun 24 '12 at 16:23

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.