A thread (here) contains a link to an article that discusses eleven advanced shortcuts, and one of these creates a QR code from various inputs. If the link to the article becomes unavailable, or if a forum member just wants to view the basics, I’ve included below a simple shortcut that creates a QR code from text (which includes a URL).
A Shortcut action that reads a QR code is not available, but scripts that will do this are available here. The following is a minor rewrite of a handler by Fredrik71, and it works well in my testing:
use framework "Foundation"
use framework "QuartzCore"
use scripting additions
set theImage to choose file of type {"public.image"} with prompt "Select an image with a QR code"
set theText to textFromQR(theImage) -- add error correction
on textFromQR(theImage) -- a minor rewrite of a handler by Fredrik71
set imageURL to current application's |NSURL|'s fileURLWithPath:(POSIX path of theImage)
set imageRef to current application's CIImage's alloc()'s initWithContentsOfURL:imageURL
set optionsDictionary to current application's NSDictionary's dictionaryWithObject:"CIDetectorAccuracyHigh" forKey:"CIDetectorAccuracy"
set theDetector to current application's CIDetector's detectorOfType:"CIDetectorTypeQRCode" context:(missing value) options:optionsDictionary
set theFeature to theDetector's featuresInImage:imageRef options:optionsDictionary
return (theFeature's firstObject())'s messageString() as text
end textFromQR
The App Store has a package of additional actions with the simple name Actions. It is free with no ads and the developer is Sindre Sorhus.
One of the actions is Scan QR Code in Image, which does exactly what is says it does. If anyone frequently needs to read QR codes and wants to stick with a shortcut, the following might be considered:
The Shortcuts app still does not have the native ability to read a QR code. The shortcuts contained below instead use the AppleScript included earlier in this thread. All of these shortcuts display the text contents of the QR codes in a dialog and copy this to the clipboard. A web page containing a few QR codes for testing can be found here.
This shortcut prompts the user to select a file that contains one or more QR codes.
This shortcut prompts the user to select an app window that contains one or more QR codes. Note should be made that the text from the QR codes may not be returned in the order of the QR codes in the app window.
I’ve encountered a privacy issue when running the QR Code Read File shortcut in certain circumstances. The simple solution is to give the Spotlight app (which is at /System/Library/CoreServices/Spotlight.app) Full Disk Access permission.
Public Beta 2 of macOS Golden Gate contains a Scan QR or Barcode action that will work on an image received as input.
The following shortcut prompts the user to select an image file and then displays the text contained in the QR code. If the image contains several QR codes, only one is processed.
The following shortcut is similar, but the user selects the QR code with the mouse. When the cursor is in screen-select mode, tapping the space bar will put the cursor into window-select mode. This shortcut does not work if run by way of Spotlight or a keyboard shortcut but works if run by way of a menu-bar icon, menu-bar collection, and the Short Run app.
BTW, the default behavior of the Scan QR or Barcode action is to return the actual QR code. This might be useful if the goal is to save a QR code in an image file (e.g. from a web page).