Get links from QR-Codes created in Indesign

Hi there

I’d like to know, if is there a way to get the URL links from QR Codes in InDesign?
The QR-Codes are created in InDesign.

Thanks in advance for your answers!
Kind regards
Marth

Assuming the QR Code is in rectangle 1 of spread 1 of active document, you can get the URL this way:


tell application "Adobe InDesign CC 2019"
	activate
	set selection to rectangle 1 of spread 1 of active document
end tell
tell application "System Events" to tell process "Adobe InDesign CC 2019"
	click menu bar item "Object" of menu bar 1
	click menu item "Edit QR Code..." of menu 1 of menu bar item "Object" of menu bar 1
	keystroke "c" using command down
	key code 53
end tell

set theURL to (the clipboard as text)

Thank you very much, works perfect!

The following script retrieves the URLs from any QR code (with embedded hyperlinks) saved as an image file (for example, as png file on the desktop). No need to open InDesign and use GUI scripting:


-- Created 2018 by Takaaki Naganoya, Piyomaru Software
-- Adapted 25 Aug 2019 by me for this topic
use AppleScript version "2.4"
use framework "Foundation"
use framework "QuartzCore"
use scripting additions

property CIDetectorAccuracyHigh : a reference to CIDetectorAccuracyHigh of current application
property NSDictionary : a reference to NSDictionary of current application
property CIDetector : a reference to CIDetector of current application
property |NSURL| : a reference to |NSURL| of current application
property CIImage : a reference to CIImage of current application
property CIDetectorAccuracy : a reference to CIDetectorAccuracy of current application
property CIDetectorTypeQRCode : a reference to CIDetectorTypeQRCode of current application

-- Select image, Convert alias to URL, Generate CIImage
set imageFile to choose file of type {"public.image"}
set imageURL to |NSURL|'s fileURLWithPath:(POSIX path of imageFile)
set imageRef to CIImage's alloc()'s initWithContentsOfURL:imageURL

-- Set detector options with NSDictonary
set optionsDictionary to NSDictionary's dictionaryWithObject:(CIDetectorAccuracyHigh) forKey:(CIDetectorAccuracy)
-- Create detector for QR Codes
set theDetector to CIDetector's detectorOfType:(CIDetectorTypeQRCode) context:(missing value) options:optionsDictionary

-- Perform QR code detection
set faceArray to theDetector's featuresInImage:imageRef options:optionsDictionary

-- Get the embeddedURLs of the detected QR code
set embeddedURLs to {}
repeat with theFace in faceArray
	set the end of embeddedURLs to (theFace's messageString()) as string
end repeat
embeddedURLs