Highlighted

Simple DATAMATRIX code

Community Beginner ,
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.

Adobe Community Professional
Correct answer by Silly-V | Adobe Community Professional

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;

TOPICS
Scripting

Views

567

Likes

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

Simple DATAMATRIX code

Community Beginner ,
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.

Adobe Community Professional
Correct answer by Silly-V | Adobe Community Professional

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;

TOPICS
Scripting

Views

568

Likes

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
Mar 19, 2019 0
Adobe Community Professional ,
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;

Likes

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
Reply
Loading...
Mar 19, 2019 4
Community Beginner ,
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.

Likes

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
Reply
Loading...
Mar 19, 2019 0
Adobe Community Professional ,
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.

Likes

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
Reply
Loading...
Mar 19, 2019 0
Community Beginner ,
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.

Likes

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
Reply
Loading...
Mar 19, 2019 0
Community Beginner ,
Mar 21, 2019

Copy link to clipboard

Copied

I finally got it:))

Thank you very much.

Likes

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
Reply
Loading...
Mar 21, 2019 1
jursulak LATEST
New Here ,
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?

Likes

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
Reply
Loading...
Oct 29, 2020 0
Resources