Sunday, September 15, 2019

#1 2019-08-16 07:38:58 am

Marth
Member
Registered: 2009-06-19
Posts: 56

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

Offline

 

#2 2019-08-17 06:28:38 pm

KniazidisR
Member
Registered: 2019-03-03
Posts: 516

Re: Get links from QR-Codes created in Indesign

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

Applescript:


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)

Last edited by KniazidisR (2019-08-18 02:45:24 am)


macOS Mojave -- version 10.14.4
Safari -- version 12.1

Offline

 

#3 2019-08-18 11:39:48 pm

Marth
Member
Registered: 2009-06-19
Posts: 56

Re: Get links from QR-Codes created in Indesign

Thank you very much, works perfect!

Offline

 

#4 2019-08-25 11:22:52 am

KniazidisR
Member
Registered: 2019-03-03
Posts: 516

Re: Get links from QR-Codes created in Indesign

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:

Applescript:


-- 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

Last edited by KniazidisR (2019-08-25 11:33:00 am)


macOS Mojave -- version 10.14.4
Safari -- version 12.1

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)