Copy link to clipboard
Copied
Hi, guys! Can someone help me?
Is it possible to change the part of URL of many QR codes applied to a document with script (java) ?
In the same document, I have several qr codes applied, such as:
https:\\teste1.com/aaa
https:\\teste1.com/abc
https:\\teste1.com/axx
(...) Its exemples.
Can I change just "teste1" to another url, exemple:
https:\\teste_new.com/aaa
https:\\teste_new.com/abc
https:\\teste_new.com/axx
Copy link to clipboard
Copied
You might want to change your post title to include "using scripting" or such, to catch the eye of the script gurus here.
I have QR code expertise, but this is basically a straightforward scripting question, so...
Copy link to clipboard
Copied
There is no way to access the InDesign generated QR Code by scripting. There is a cumbersome way to export the QR Code as snippet and then find the URL in the XML and modify it by script.
Copy link to clipboard
Copied
So as in nearly every other instance of "ID-generated QR Code" the real answer is "re-generate it."
Which I believe can be done with scripting, and with various implementations of data merge.
Copy link to clipboard
Copied
Generated QR code is an EPS - that isn't even embeded - there is nothing in the Links panel...
Copy link to clipboard
Copied
They're EPS? Really?
What makes this confusing is that the generation/placement is interactive within ID. You can edit an existing code, and hover over one to get the raw content used, so there is SOME data stored SOMEWHERE... but in some fully encapsulated manner no other approach can reach.
A good feature, potentially great but desperately overdue for some TLC and expansion.
Copy link to clipboard
Copied
But like I've said - NOTHING in the Links panel - so it's must be embedded.
Copy link to clipboard
Copied
"They're EPS? Really?"
They're EPS in that they are made of very simple Postscript objects. When a ID creates a QR code, it generates the code in a temporary PS-based file in InDesign's cache folder on your computer, silently embeds this code in the .indd file (meaning it won't show in the Links panel), then deletes the temp file from the cache folder. You can actually open an .indd file in a text editor and find it. It will look like this:
 
 
In an .idml, The PS objects are converted to XML CDATA. Along with it is the URL, and although, you CAN change it, this will not update the graphic elements... that needs to be regenerated. Besides, ID doesn't like .idml files that have been externally messed with in the best of times.
Of course, none of this answers the scripting issue. 🙂
Copy link to clipboard
Copied
Copy link to clipboard
Copied
"...but desperately overdue for some TLC and expansion."
Yup. It would be nice to have a panel such as the Interactive > Hyperlinks panel that can manage QR code content without having to go to each individually and regenerate.
Copy link to clipboard
Copied
It is an excellent tool, as good as any I know, with the advantage of being 100% local and secure and imposing no stealth tracking or redirection elements. But I'd like to see:
Copy link to clipboard
Copied
There are various create***QRCode() methods, so you'd only retrieve the old values from the snippet of the EPS.
No need to modify and re-place the snippet.
Copy link to clipboard
Copied
It is not clear to me where this data is stored; I know that in prior conversations the idea of pulling up the data within ID has proven difficult. ID does store it somewhere, as it can be displayed with a hover tip or when opening the QR editing menu, but if it can be *usefully* accessed... that's semi-news to me.
Copy link to clipboard
Copied
"It is not clear to me where this data is stored"
Embedded Inside the .indd file itself (not at all accessible (but again, if you open the file in a text editor, you can "see" it right after the code for the QR code itself.)
When exported as as .idml, it can be found in the XML files located in the "Spreads" folder.
e.g.:
 There's also a flag to not show the code in the Links panel: ShowInUI: false
Copy link to clipboard
Copied
Yeah, I assumed it was in the file somewhere, but unless I am misrecalling prior discussions it's not accessible in any useful way.. So... are there scripting hooks that can retrieve and/or rewrite it?
Copy link to clipboard
Copied
There are various create***QRCode() methods
Hi @Dirk Becker , There are the creation methods—an new QR code can be created on a page or a page item like a rectangle, but I don’t see any way of getting a collection or an array of QRcode objects via scrpting. I can get a collection of EPSs, which will include document generated QRCodes, but unless I’m missing something there is no way to determine if the EPS is a QRcode and change its properties.
Copy link to clipboard
Copied
@rob day For retrieving the old value you have to go the unfortunate way via snippet.
@Stefan Rakete suggested "then find the URL in the XML and modify it by script" which could be read as within the snippet.
Copy link to clipboard
Copied
If you find you need to change the info in a QR code, even on a semi-regular basis, you might consider going to a Dynamic QR code model instead of use ID and static codes. This is really good for vCard QR codes for business cards, for example
Copy link to clipboard
Copied
The only 'dynamic' model that works at all is a fixed URL encoded into the QR code, pointed to active redirection of some kind that can be changed. I don't know any way to make data-content codes 'dynamic.' But the OP is looking at a URL solution, so all that's needed is a stable redirection platform, which can be a company web server.
Copy link to clipboard
Copied
Indeed.