Copy link to clipboard
Copied
I'm getting "Error 1220: Illegal Argument" for this line.
textRef.textRange.justification = Justification.CENTER;
If I comment it out the script runs fine. This was working fine before I updated to CC 2018.
Does anyone have any idea why this is throwing an error now?
Copy link to clipboard
Copied
The TextRange object doesn't have justification, it's inside the textRange.paragraphAttributes property. But this doesn't really answer the question -but try it out?
Copy link to clipboard
Copied
I tried this out:
textRef.textRange.paragraphAttributes.justification = Justification.CENTER;
Exact same error unfortunately.
Thanks for replying!
Copy link to clipboard
Copied
It seems work fine in Illustrator CC(ver.22) like below.
check your textRef variable when you get an error.
Copy link to clipboard
Copied
hmm...both of these work on Win10, CC2018
var idoc = app.activeDocument;
var sel = idoc.selection[0];
sel.textRange.justification = Justification.CENTER;
sel.textRange.paragraphAttributes.justification = Justification.CENTER;
Copy link to clipboard
Copied
Found the solution here.
Re: What's New in Illustrator Scripting CC2018
I guess the text area needs to be populated before changing paragraph attributes in cc2018.
Thanks for the help.