0
copying to new document by javascript - it's a bug
Engaged
,
/t5/illustrator-discussions/copying-to-new-document-by-javascript-it-s-a-bug/td-p/12789285
Mar 03, 2022
Mar 03, 2022
Copy link to clipboard
Copied
It is not easy to copy all elements from one document to another document with a Javascript.
I have found an error in the programming for objects of the type "text on path".
By copy & paste the value of textFrame.startTValue is set to 0 instead of keeping the old value. Very annoying!
And here my Javascript to copy this to a new document:
var vDocRef = app.activeDocument;
var vArtboard = vDocRef.artboards[0];
var aAR = vArtboard.artboardRect;
var vPosXY = vDocRef.pageItems[0].position;
var vOldValue = vDocRef.pageItems[0].startTValue; // get the start text value (A)
vDocRef.pageItems[0].selected = true;
app.copy();
var newDoc = app.documents.add();
newDoc.artboards[0].artboardRect = aAR;
app.activeDocument = newDoc;
app.paste();
newDoc.pageItems[0].position = vPosXY;
app.executeMenuCommand("fitall");
app.redraw();
alert("stop, see the wrong position of the text on the path. " + newDoc.pageItems[0].startTValue + " is not " + vOldValue + " – Correct it."); // (B)
newDoc.pageItems[0].startTValue = vOldValue; // correct the start text value (C)
( A ) need to save the startTValue
( B ) shows the problem/bug
( C ) put the old startTValue to the copied textFrame.
TOPICS
Scripting
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explore related tutorials & articles
Guide
,
/t5/illustrator-discussions/copying-to-new-document-by-javascript-it-s-a-bug/m-p/12790522#M312222
Mar 03, 2022
Mar 03, 2022
Copy link to clipboard
Copied
This is not what I get (in CS6). The two startTValues are the same (without correcting them).
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Parts4Arts
AUTHOR
Engaged
,
LATEST
/t5/illustrator-discussions/copying-to-new-document-by-javascript-it-s-a-bug/m-p/12804183#M313079
Mar 10, 2022
Mar 10, 2022
Copy link to clipboard
Copied
Thanks for testing. But I have the problem in CC 2020 and CC 2022. Look's like a bug to me.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

