Skip to main content
Participating Frequently
October 29, 2021
Answered

Change qrcodes color script

  • October 29, 2021
  • 3 replies
  • 1279 views

Hi, im trying to change qrcodes color with js script.

I have a list of qrcodes know and I tried with: 

app.menuActions.item("Edit QR Code...").invoke();

to edit.. so after this step i need to swith to Color tab and after that select name of color..

any suggest? or is there a better way maybe?

This topic has been closed for replies.
Correct answer Laubender

Hi Mesmaili,

did you see into the DOM description?

Property qrCodeSwatch is the one you are looking for.

It will work when you create a new QR code.

 

It will not work after you added a QR code. At least I assume that's your issue.

If you do not want to recreate QR codes see into the other method Colin provided.

The one with the transparency mask. Also scriptable of course.

 

Regards,
Uwe Laubender

( ACP )

 

3 replies

LaubenderCommunity ExpertCorrect answer
Community Expert
November 4, 2021

Hi Mesmaili,

did you see into the DOM description?

Property qrCodeSwatch is the one you are looking for.

It will work when you create a new QR code.

 

It will not work after you added a QR code. At least I assume that's your issue.

If you do not want to recreate QR codes see into the other method Colin provided.

The one with the transparency mask. Also scriptable of course.

 

Regards,
Uwe Laubender

( ACP )

 

MesmailiAuthor
Participating Frequently
November 4, 2021

Hi Laubender,

thanks for your answer.

you are right, im trying to change qrcode color after generating.

actually I create qrcodes with dataMerge and need to be another color..

James Gifford—NitroPress
Legend
October 31, 2021

Bypass ID altogether, or use it as a generation/export tool, and recolor the QRcode image in Photoshop. Re-import.

 

I suggest this only because your need doesn't seem to be efficient on-the-fly generation, as some uses require — at least, I can't quite visualize the intersection of such efficient production/update and a need to tweak the colors so precisely. 🙂

Colin Flashman
Community Expert
Community Expert
October 31, 2021

The DOM for that portion of code is here:

https://www.indesignjs.de/extendscriptAPI/indesign14/#EPS.html#d1e240502__d1e242534

However, if you're doing this via data merge, I wrote an article that makes colorising QR codes much easier: https://creativepro.com/creating-colored-qr-codes-during-a-data-merge/

 

If the answer wasn't in my post, perhaps it might be on my blog at colecandoo!
MesmailiAuthor
Participating Frequently
November 4, 2021

Thanks Colin.
I selected my element but fillColor doesnt work for qrcodes!