Inserting and Replacing Text With Shortcuts

You can use the Shortcuts app on your Mac to create quick text inserts or replacements. The Shortcut can prompt for text, let you choose from a list, or include the current date and time.
You can also watch this video at YouTube.
Watch more videos about related subjects: Shortcuts (70 videos).

Video Transcript

Hi, this is Gary with MacMost.com. Let me show you how to insert or replace text using a shortcut on your Mac. 
MacMost is brought to you thanks to a great group of more than 1000 supporters. Go to MacMost.com/patreon. There you can read more about the Patreon Campaign. Join us and get exclusive content and course discounts.
So one of the handy things you can do with the Shortcuts App is to insert text right where the text cursor is located. This could save you a lot of time and could be a useful productivity tool. Let me show you a bunch of different ways that you can use this. 
So, I'm using macOS version 12.3 and this is the version of Shortcuts I'm running. Make sure you're using at least this version or newer to have all these features. So let's create a new shortcut here. One of the things you could do with a shortcut is create a piece of text. Let's go and do that. I'm going to grab this text action here. If you don't see it you can search for it. This just allows you to type a piece of text. So let's do something like this. Let's say I want to actually place that wherever the text cursor is. The key to doing that is going here to the Settings and then looking for Provide Output. I turn that On and it's going to add this action at the bottom. Stop and output. In this case since all I had there was the text action it's going to link it so that it's going to Stop and Output the text. So wherever I have the text cursor it should place whatever I have in here. Let's call this Insert Text and let's assign it a keyboard shortcut to make it really easy to use. So I'm going to click here to Add Keyboard Shortcut. When I do that it's going to add Use as Quick Action and Services Menu because its going to need that for a shortcut. I'm going to use Shift Command and then the quote key as my shortcut. At the top here it says Receive any Input from Quick Action. We don't need any input at all. We're just going to clear that out. So it's going to receive no input. Then it's going to create this piece of text and output it. 
So let's switch over to Mail. I'm going to check first that under Mail, Services it is there. You can see the keyboard shortcut as well. I'm going to use it the first time here in the Services Menu. I find that that works better because sometimes the keyboard shortcut doesn't take effect right away until you use it here first. So when I use it here you could see it inserted the text perfectly. Let's delete it and let's try to use the keyboard shortcut. Shift Command quote. Now you can see I can easily enter that text anywhere that I'm typing in an app like Mail, Text Editor, or Pages just by using that keyboard shortcut. Of course this text could be much longer than this. It could be a whole paragraph or several paragraphs. I can easily insert it wherever I want. 
However, you could use Text Replacements for that. You don't necessarily need to create an entire shortcut just to have text put in a location. But a shortcut allows you to do some more useful things. Let's do the date, the current date, instead of this. So I'm going to get rid of this. I'm going to search here for Date and I'm going to grab the date, put it there, and it's going to get the current date. In order to have that become text I'm also going to get Format Date right here and put it afterwards. So it's going to get the Current Date and then format it. If I click on Show More you can see I can set the Date and Time format, and the location. Under Date Format there's a variety of different formats that you can choose from. You can try all of these including Custom which allows you to use standard little internet date formats here, like that. Let's just go and use Long for now and leave Time format as Short. I could also set it to None if I don't want the time at all. 
So you see Current Date is fed into Format Date and the output of that is fed into Stop and Output. Everything is setup there. So you want to check all that before you try to use a shortcut to make sure everything is linked properly. So now in the Mail App I'll just use the same keyboard shortcut. Now I get the date and time in that location. This could be super handy for pasting the date into spreadsheets or using it in messages or anything you want to do. It will always be the current date and time. So if I use it again you could see now it's updated for the new minute. So let's try something else. Let's remove the Date and instead have it prompt us for what to actually place there. So I'm going to search for Prompt and I'll come up with Ask for Input. Let's put Ask for Input here and it's going to ask for text with the prompt and you could put something like that. Then we can click Show More and we see there's a default answer. Let's set the default answer to something useful. 
So you could see here I've got a little long response. Something you may want to use in a response in an email or text message. Let's try that out and you could see it comes up, What do you want to say?. It's got all that in here. I could actually select something and change it to something else before clicking Done or using Command Return to put it in there. So it's already pretty useful because it means I don't have to type this entire thing yet I could have customized one part of it before I press Command Return or I can customize it right now. 
Let's go back to this and instead of having everything here let's clear this out and change this to, which product. Now let's use Text again and place that below right here and place this. So what we're missing should go right here. So we want whatever the answer to this is to go right there. So I'm going to put the cursor there and I'm going to either Control Click, Right Click, or two-finger Click on a trackpad, insert variable, select variable, and then select the output from the Ask for Text. So now it's going to Ask for Text, we type some text, and it's going to create a final piece of text generated with this  right there in the middle, and then output that. Let's give it a try. It's going to ask us which product. We can say like product A, and then Done or Command Return. We can see it outputs text with whatever we entered in the proper spot. 
Now instead of having us type anything at all what if we could choose from a list. Let's get rid of Ask for Text and instead go to Choose and there's Choose From List. Let's place that there. Choose From List requires a list as input. So, we're going to search for List and we'll grab List and place it right above. List is prefilled with two entries. The words One and Two. You can add more. Let's add Three. We can change them like this and add as many as we want here. We can see List feeds right into Choose From List very nicely. Then the result from this isn't going into Text because we previously had it set to where you could type your input there. So I'm going to select this and clear it out and I'm going to Control Click in here and insert variable, select variable, and get the Chosen item. So now we create a list, we choose from it, then we create this text that includes whatever was chosen from the list there, and then we output it. Let's give it a try. You can see it comes up with one of those three. I can select one and click Done or just double click on one. You can see it properly puts that in that spot right there making it really easy for us to type responses like this by making a simple selection. 
I want to show you one more that would be nice. Like what if you would just type something like this and you could select it and then have it replaced with all that text surrounding the original selection. So we'll get rid of this and this and instead change Receive, from nothing, to Allow it to Receive Text or Rich Text, and now that comes in here and I'm going to go here and clear this out and instead insert a new variable and set it to the shortcut Input. So now it should take any text or rich text that is selected when we invoke the shortcut and then generate this text using that selected text and then send it out. Since we have that text selected it should replace it. So I've got this selected here. I'll use Shift Command quote. You can see how it instantly converts that to the full text including whatever it is we had selected. If I had put something like that and then selected it and then used the shortcut it would put that selection instead.
So there are a bunch of good examples of about how you can create simple shortcuts that make it easier for you to type text, especially text that you're using all the time. You could choose from a list or prompt for something or take the selection or do any combination of those things. Whatever will help you type long pieces of text throughout the day to increase your productivity. 
I hope you found this useful. Thanks for watching. 

Comments: 8 Comments

    Eliot Houman
    3 years ago

    Hi there - is there a way we can use a shortcut to paste a QR code onto a PDF? We typically use an ink stamp to add a QR code to our mail, and then have a scanner batch scan and separate based on QR code. I'm noticing that the quality of the ink stamp is not great. It would be great if I can put our QR code in clipboard, and then use a keyboard shortcut to have it paste into the PDF when viewing the PDF in preview. Is that possible?

    3 years ago

    Eliot: A QR code is just an image. When you are creating the PDF in whatever app you use (Pages, Word, InDesign, etc) just drag and drop the QR code image in there and place it where you want. If you copy the image contents to the clipboard you can paste it as you would paste anything else. No need for a Shortcut here, just drag-and-drop or Paste.

    Steve
    3 years ago

    The shortcuts you present work OK for me with text apps and Mail.app, but not with the Messages.app.

    3 years ago

    Steve: Hopefully something they fix at some point.

    Bart
    3 years ago

    Thank you!
    It was exactly what i'm looking for, very simple.

    Regards

    Bart
    3 years ago

    Hi, i noticed that this command is working only on Mac, but not on iPad/iPhone. Do you have any suggestion to solve this?

    3 years ago

    Bart: I'm pretty sure it will only work on a Mac as you don't have the same text Quick Actions/Services functionality in iOS.

    Bart
    3 years ago

    Ok, thank you for the reply. I tried to execute shortcuts via Siri, with cursor focused on a note before to speak the command. Btw it would be very useful if apple will enhance iOS to catch a text through the output of a shortcut and send it to the focused filed.
    Regards

Comments are closed for this post.