• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Simple DATAMATRIX code

Community Beginner ,
Mar 19, 2019 Mar 19, 2019

Copy link to clipboard

Copied

I got this "simple" code for generating DATAMATRIX (ascii) (link).

It works great in Extend Script but doesn't work in Illustrator.

Please help.

TOPICS
Scripting

Views

3.5K

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

Valorous Hero , Mar 19, 2019 Mar 19, 2019

Now is your great opportunity to port Node.js code into ancient EcmaScript 3!

What you have to do it go to https://github.com/tualo/tualo-datamatrix/blob/master/lib/datamatrix.js . and make it work inside of your Illustrator.

At brief look-over it does not appear that this code uses many modern features for ES3, so this will likely be an easy task!

The only modern feature I could see is the "exports" statement at the very bottom. I think you can just get rid of that.

Actually I couldn't help myself

...

Votes

Translate

Translate
Adobe
Valorous Hero ,
Mar 19, 2019 Mar 19, 2019

Copy link to clipboard

Copied

Now is your great opportunity to port Node.js code into ancient EcmaScript 3!

What you have to do it go to https://github.com/tualo/tualo-datamatrix/blob/master/lib/datamatrix.js . and make it work inside of your Illustrator.

At brief look-over it does not appear that this code uses many modern features for ES3, so this will likely be an easy task!

The only modern feature I could see is the "exports" statement at the very bottom. I think you can just get rid of that.

Actually I couldn't help myself and did a test.

If you put in the code above with my exact instructions, it works!

/*

... the datamatrix.js code pasted in above ...

*/

var doc = app.activeDocument;

var str = "ABCDEFG!";

var dm = new Datamatrix();

var ascii = dm.getDigit(str, false);

var newText = doc.textFrames.add();

newText.size = [500, 500];

newText.contents = ascii;

Votes

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
Community Beginner ,
Mar 19, 2019 Mar 19, 2019

Copy link to clipboard

Copied

Thank you for your fast reply.

I done it as you said

first code datamatrix.js

and at the bottom

your code.

I saved this and run it from Illustrator "Scripts/Other Scripts.."

but doesn't work. I don't know what I am doing wrong.

Do I need node.js installed?

Is it possible for you to send me link to your working version of jsx file.

Thank you very much.

Votes

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
Valorous Hero ,
Mar 19, 2019 Mar 19, 2019

Copy link to clipboard

Copied

It's easy - you probably just didn't take out the export statement like I have instructed?

Make sure the line "export Datamatrix" or whatever - is gone.

Votes

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
Community Beginner ,
Mar 19, 2019 Mar 19, 2019

Copy link to clipboard

Copied

Yes I did that and still doesnt work.

Strange thing for me is that if I runscript in ExtendScript works fine.

screen5.png

but when I run it in Illustrator I get error.

screen4.png

screen2.png

screen1.png

I hope there is answer to my problem;)

Thanks again.

Votes

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
Community Beginner ,
Mar 21, 2019 Mar 21, 2019

Copy link to clipboard

Copied

I finally got it:))

Thank you very much.

Votes

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
New Here ,
Oct 29, 2020 Oct 29, 2020

Copy link to clipboard

Copied

Hi—
I am running into the same problem that you experienced @gorazdr45766660, what did you do to make it work?

Votes

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
Community Beginner ,
Aug 15, 2021 Aug 15, 2021

Copy link to clipboard

Copied

Don't you love when someone has a problem with something and posts and update that they solved it without the working solution 😞

Votes

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
Valorous Hero ,
Aug 16, 2021 Aug 16, 2021

Copy link to clipboard

Copied

hope-family

Votes

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
Enthusiast ,
Mar 24, 2023 Mar 24, 2023

Copy link to clipboard

Copied

The problem is that "Matrix" is a reserved word in ExtendScript Illustrator, and this code uses it as a variable. For those looking for a solution: Replace "var Matrix", "Matrix.prototype" and "new Matrix" everywhere with any other variable name, for example "MatrixObj".

Votes

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
New Here ,
Jul 29, 2024 Jul 29, 2024

Copy link to clipboard

Copied

LATEST

Hi everyone, sorry to open old wounds.  
I'm attempting to utilize this script (https://github.com/tualo/tualo-datamatrix/blob/master/lib/datamatrix.js) in Illustrator which is going well.  I've however been tasked with transforming the output of this script into a scannable data matrix.  I'm able to take the output of datamatrix.js and format using excel to create a working barcode but can't come close to replicating this in Adobe Illustrator.

I'd be fine if I could find a way to do an "if" this equals 0 then do white square else do black square.  Even doing a format to change font formatting for 0 to be white font, white background and 1 is black font, black background.  I've been trying to slice and dice this script and I'm definitely no expert when it comes to creating scripts in Adobe Illustrator.

Any help would be greatly appreciated.  Thx 🙂

Votes

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