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.
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
...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;
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.
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.
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.
but when I run it in Illustrator I get error.
I hope there is answer to my problem;)
Thanks again.
Copy link to clipboard
Copied
I finally got it:))
Thank you very much.
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?
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 😞
Copy link to clipboard
Copied
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".
Copy link to clipboard
Copied
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 🙂