21
7
I have a text phrase (actually, several phases) that I use frequently in multiple applications. I'd like to create a keyboard shortcut or hotkey that will paste this text phrase wherever I have placed my cursor in a text input field (Apple Mail, Microsoft Word, TextEdit, TextWrangler, browser windows, etc.) rather than constantly copying and pasting from a sticky note.
I'd prefer not to have to buy any apps (seems like Keyboard Maestro has this functionality but seems silly to pay $36 just for this), though free apps would be fine. Tried looking under System Preferences > Keyboard > Keyboard Shortcuts but no obvious solution, and all AppleScripts I found seem to not translate properly for me. I've found other solutions for this problem on this forum for Windows users (like AutoHotKey) but none for Mac users.
@slhck this sounds like a great way to do this, but could you detail your answer a bit more? I'm not fluent with the way Automator works, when I launch it it asks me "chose a type for your document" and then I'm kind of lost. I'll go with Jonathan Huie's answer for now but it still implies typing something... Thanks! – MicroMachine – 2015-10-17T23:38:55.703
@fabriced You need to create a Service in Automator. – slhck – 2015-10-19T08:50:04.320
2I find that this works in a text editor, but not in a text field on a website. Anyone else? – Eliot – 2015-10-23T18:51:58.197
@slhck, is there way to type the text from clipboard instead of the hardcoded text? – stansult – 2016-12-15T20:46:45.203
Update: it’s “tell application "System Events" to keystroke (the clipboard)” right? – stansult – 2016-12-15T20:57:56.473
Feel if the script is not running, see: https://apple.stackexchange.com/a/247183/296553
– Ankit – 2018-07-23T14:38:52.070only works when text is selected – mipmip – 2018-09-06T12:10:06.670
Wow, thanks so much @slhck! I tried this, but am having problems in the last step. It's not showing up in the "Services" menu when I go to "Keyboard Shortcuts" in System Preferences. I know it runs because when I open Automator and hit Play, the text is typed in the previous application, but it won't show up in service so I can add a keyboard shortcut even though I have saved it in my Library > Services folder. On the advice of other forums I Googled, I double-checked that the service input was set to "Service receives: no input" (it was) and tried relaunching the Finder. Any thoughts? – Ruthie – 2013-01-30T00:56:10.027
So you saved it from Automator? Normally it should appear in the Keyboard Shortcuts options, under Services and General at the bottom. Have you tried logging out and back in, or even restarting? – slhck – 2013-01-30T08:06:48.303