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.