I want to be able to make a keyboard shortcut system wide on a Mac that will paste some text into whatever I am selecting. For example, I am typing in notes and I press cmd + alt + k, then text that says "Hello World!" will paste into the text box. I was looking for other answers to this but couldn't find any.
MacOS – How to set a keyboard shortcut to paste text
keyboardmacos
Related Question
- Deselect text using keyboard shortcut or prevent selection of word/link on right click
- How to display the current mapping for keyboard shortcuts in realtime
- MacOS – Cannot press Shift+T in OS X
- MacOS – “Paste and Match Style” OSX Notes Keyboard Shortcut Doesn’t Work
- MacOS – How to hyperlink ‘text’ within a note in the macOS Notes app
- How to add a set of keyboard shortcuts for document/text applications in System Preferences with Automator
Best Answer
You could create this using AppleScript and run it using Automator.
Create a script:
Replace "Hello World." with your desired text, but make sure to keep the quotation marks around whatever text you input as that is what is making the data type a string.
Next, use Automator to trigger the above AppleScript:
services
workflow.Service Recieves
tono input
.in
toany application
.Finally, use System Preferences to assign this workflow to a global hotkey.
This is probably the easiest way of accomplishing your desired task while writing the least amount of code as possible.
There is also a tool called Alfred that is outstanding; I use it many times on a daily basis. At this point I would probably be lost without it. It can completely take over spotlight for you (in fact I deleted the hotkey to bring up spotlight search (cmd + space) and assigned that hotkey to open Alfred instead. Within Alfred you can do things such as copy text from one place, then copy more text from somewhere else and append them together, do anything that you can do in Spotlight search, plus much, much more. The reason that I bring up Alfred is because you can create this same exact workflow within Alfred and assign it to a system wide hotkey all within the same application without writing and code at all (if you consider the example that I just gave to actually be writing code). In fact, the types of workflows you can create in Alfred is essentially limitless and there are even already built recipes online, for different applications that you can download.