Building a Mac Shortcut To Easily Generate QR Codes

You can use the Shortcuts app to make QR codes that link to web pages. Once you have a Shortcut, you can easily reuse it to share a QR code, save it as an image, or even just copy to the clipboard to paste into a document you are working on.
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 create QR codes using Shortcuts 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, of course, we all know what QR codes are. The last few years have taught us that they are those little digital images you can see various places, like in restaurants, when you can get the menu by pointing your iPhone's camera at the QR code. You can easily create your own QR codes for any website or webpage that you have. So if you have a business website or a personal blog or anything like that you can create a QR code for it. Even the address to a twitter or instagram account can be turned into a QR code. Anything you can bring up in the Safari web browser can be made into a code and you can do that with the Shortcuts app. 
Let's create a new shortcut here and we're going to search, right away, for QR right there and Generate QR code comes up. So how do you use this. Well, Generate QR Code from Text will turn any text, like abc, into a code. Just Run and this is the code for abc. Now that doesn't help much. What you need is a URL. So you could type in a URL, like this, and run it and that's the QR code with that text in it. If you point a camera at that code it's going to come up and clicking on it will take you to that webpage. So already this is pretty useful.
What would be better is if it actually made a QR code for the webpage you are currently viewing. So, for instance, if I'm in Safari like this it would be great to be able to create a QR code for this page. Then I could go to any page I want and quickly create a QR code for that one and then use it somewhere. Use it in something I'm going to print or email or whatever. 
Let's start off by searching for something that would get the webpage location. Now what we can do here is get the current webpage from Safari. Now you can also set this up as a QuickAction or Service to use in Safari or when you've selected a URL to turn that into a QR code. But I find it is a lot easier if you just go with whatever the front-most page is in Safari, whatever the URL is that is showing there. That way you could bring up the page in Safari and use this from the Menu Bar,  having it pinned in the Menu Bar or any other way even in the Shortcuts app. It just will get that current page in Safari and use that.
Now let's get rid of this right here and I'm going to Control Click on it. Insert variable, Select the Variable, select this. So now it's going to get the current webpage from Safari. It's going to feed that into generate QR code from. Now let's give it a name. Also some place to output to because we're not always going to be running it here in the Shortcuts app. So if I search for Quick, I get Quick Look. Now the output will actually go to Quick Look. So now when I run it here you could see it appears there in Quick Look. I can do various things with it using the Share Menu. Let's see how this looks in Safari. Let's go to another page here, like this one. Let's say I want to use it here. I can click there and so I say Pin to Menu Bar. There it is. It's going to output the result to Quick Look and there is that. I can share it using this Menu here. I could also open in Preview and then I could simply Command C to Copy. With it copied I could do something really easy. Like, for instance, if I'm making a flyer in Pages I could just Command V and paste it in. Resize and add a QR code to a flyer.
Another way to go instead of using Quick Look you could just Search for Clipboard and Copy to Clipboard. So now all it's going to do is get the current webpage. It's going to generate the QR code and then it is going to copy it to the Clipboard. When I do that it runs. It's copied to the Clipboard right away. So now in Pages I can paste it in there. So if your main goal is getting it to the Clipboard quickly so you can use it in documents then you may want to go with something really simple like this. 
Now let's say I want to Save this as an image file instead of having to do something with it right away. Well, what I can do here is just use the Save command, Save and then Save File, and it will Save QR code. Show More will show me the password to save. Let's turn that off and instead it will save it and I click here to replace the Shortcuts folder with something else, like say the Desktop. Now it is going to save it to the Desktop. Now let's get rid of this Quick Look here. Now when I run it the first time it is going to ask me to give permission and now you could see here I've got it on the Desktop. It has a very generic file name. So let's fix that with a Rename. Rename File to what. Well, let's go ahead and get the details of the webpage. I'll look for Details. You can get the details on a Safari webpage. Let's go and put that right up here. Get page contents is not what we want. What we want is the name of the page. That would be handy to rename the file. So I'll click here. Control click on it actually. Select variable. Use the name there. Now when I run you could see how it takes the name of the page and uses that as the name for the file. 
So if I were to go to somewhere else and then Create QR code. It runs and you see I get the name of this page. I can generate it for any pages I want and you could see how it creates one for each. So you could easily, instead of sending this to the Desktop, send it to a special folder and then fill it up with the QR codes you need and know where each one goes because they are named properly. Now you can use them in all sorts of documents to make it easier for people to grab a URL and get to a page using their phone. Hope you found this useful. Thanks for watching. 

Comments: 14 Comments

    nick
    3 years ago

    Great video Gary, thanks.Just so happens we're making flyers for a volunteer organization so this couldn't have come at a better time !! Always amazed at how user-friendly the Mac environment is.

    lauren eisen
    3 years ago

    love this! thank you gary

    nick
    3 years ago

    Gary: just fyi when I control-click to select the Name for the Saved File, my context menu shows "Select Magic Variable", maybe a difference based on OS version? I'm running 12.4

    Doug Rogers
    3 years ago

    Hey, Thanks. Everything below getting the frontmost page details works. "Get current webpage from Safari" balks and doesn't link to or pass anything below it. :-(

    Cyrus Dubash
    3 years ago

    Thanks for this Gary I tried creating a shortcut from my contact that is saved in my phone so I can easily share it with people. But only the first name shows up after the QR code is scanned.

    How do I generate a QR code for my Contact?

    thanks

    3 years ago

    Cyrus: Not sure what you did to create the QR code, but I don't think you can do that in Shortcuts. QR codes usually just go to a web URL or show some text. So maybe have the QR code go to a page on your website with your contact info?

    Roger Bird
    3 years ago

    Hi Gary,
    I only seem to be able to get the Shortcuts App for Iphone or Ipad. Is there an App for Mac as you seem to be using or am I thick!!!

    3 years ago

    Roger: Yes, the Shortcuts app was introduced with macOS Monterey.

    Phyllis Capanna
    3 years ago

    Another resource to explore! How did you get the Shortcuts app icon onto your menu bar up top??

    3 years ago

    Phyllis: In at least one Shortcut, have the setting "Pin In Menu Bar" turned on.

    JL
    3 years ago

    Hi Cyrus! I know this is late, but I found this on the Apple forum, just look up "Make QR Code" in the Shortcuts Gallery, run it and select "Add Contact", then select your contact information. It will generate the QR code.

    Tom Gonser
    3 years ago

    Excellent resource! One minor issue - my image shows on the desktop as a generic png file. I'd much prefer it to show as a QR code as your demo produces. Any hints on that? Tom

    3 years ago

    Tom: Do you see other icons for image files as previews, or not? Maybe you have View, Show View Options, Show Icon Preview turned off for that folder?

    Daniel
    2 years ago

    This does indeed create a QR code, but not one that automatically takes you to the web page; instead, it just allows you to search for the web address. I think it's because the QR code does not include either "http://" or "https://". I don't know if this is behavior that was introduced with system changes since this shortcut was initially published, but suffice it to say that entering http://someURL into the text box of the Generate QR Code item in Shortcuts works; omitting the http:// does not.

Comments are closed for this post.