Script qr code

Explorer ,
Feb 04, 2021 Feb 04, 2021

Copy link to clipboard

Copied

Can somebody help me with a script that find url codes and change it to a QR code with a object style named test.

 

kind regards,

Patrick

TOPICS
Scripting

Views

132

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Feb 12, 2021 Feb 12, 2021
Try this snippet :    ////////////////////////////////////////////////////////////////////////////////////////////////////// app.findGrepPreferences = NothingEnum.nothing; app.changeGrepPreferences = NothingEnum.nothing; app.findGrepPreferences.findWhat = "((([A-Za-z]{3,9}:(?:\\/\\/)?)(?:[-;:&=\\+\\$,\\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\\+\\$,\\w]+@)[A-Za-z0-9.-]+)((?:\\/[\\+ \\/.\\w_]*)?\\??(?:[-\\+=&;%@.\\w_]*)#?(?:[\\w]*))?)"; var allFound = app.documents[0].findGrep(); for(var i = 0; i < al...

Likes

translate

Translate

Translate
Adobe Community Professional ,
Feb 08, 2021 Feb 08, 2021

Copy link to clipboard

Copied

Try this below snippet for add QR code for URL:

//////////////////////////////////////////////////////////////////////////////////////////////////////
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.findWhat = "(ftp:\/\/|www\.|https?:\/\/){1}[a-zA-Z0-9u00a1-\uffff0-]{2,}\.[a-zA-Z0-9u00a1-\uffff0-]{2,}(\S*)";
var allFound = app.documents[0].findGrep();
for(var i = 0; i < allFound.length; i){
    var urlLink = allFound[0].texts[0].contents.toString();
    var qrCodeObject = allFound[i].insertionPoints[-1].rectangles.add({geometricBounds:[0, 0, 10, 10]});
    qrCodeObject.createHyperlinkQRCode(urlLink);
    qrCodeObject.label = "QR-URL";
    allFound[0].texts[0].contents = "";
    app.documents[0].recompose();
    allFound = app.documents[0].findGrep();
    }
//////////////////////////////////////////////////////////////////////////////////////////////////////

 

After placement of all QR code if you want to change size of those QR codes find them with their script label & can change the geometric bounds or apply any object style.

 

Best

Sunil

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 11, 2021 Feb 11, 2021

Copy link to clipboard

Copied

When i have a URL like www.bcm.nl it's working fine. When i have http://www.bcm.nl he makes a QR code of http://www.bcm and the .nl he dont take it.

so i get (QR code).nl

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 12, 2021 Feb 12, 2021

Copy link to clipboard

Copied

Try this snippet : 

 

//////////////////////////////////////////////////////////////////////////////////////////////////////
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.findWhat = "((([A-Za-z]{3,9}:(?:\\/\\/)?)(?:[-;:&=\\+\\$,\\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\\+\\$,\\w]+@)[A-Za-z0-9.-]+)((?:\\/[\\+ \\/.\\w_]*)?\\??(?:[-\\+=&;%@.\\w_]*)#?(?:[\\w]*))?)";
var allFound = app.documents[0].findGrep();
for(var i = 0; i < allFound.length ; i){
    var urlLink = allFound[i].texts[0].contents.toString();
    var qrCodeObject = allFound[i].insertionPoints[-1].rectangles.add({geometricBounds:[0, 0, 10, 10]});
    qrCodeObject.createHyperlinkQRCode(urlLink);
    qrCodeObject.label = "QR-URL";
    allFound[i].texts[0].contents = "";
    app.documents[0].recompose();
    allFound = app.documents[0].findGrep();
    }
//////////////////////////////////////////////////////////////////////////////////////////////////////

 

[Code Edited]

Sunil

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines