Copy link to clipboard
Copied
Hi everyone,
I want to replace the word "PANTONE " with "P." in all text objects in the document.
i've managed to take content from one textFrame and replace it just like i want, but it works only in JS console
function test(){
var doc =app.activeDocument;
var t = doc.textFrames.getByName("usedcolor5").contents.replace("PANTONE ", "P.");
return t;
};
test();
my file looks something like this:
Thanks it actually helped
Here is my code:
#target illustrator
function test() {
var doc = app.activeDocument;
var myArray = ["usedcolor1", "usedcolor2", "usedcolor3", "usedcolor4", "usedcolor5", "usedcolor6", "usedcolor7", "usedcolor8", "usedcolor9"];
for (var i = 0; i < myArray.length; i++) {
var t = doc.textFrames.getByName(myArray);
var txt = t.contents.replace("PANTONE ", "P.");
t.contents = txt;
}
};
test();
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thanks it actually helped
Here is my code:
#target illustrator
function test() {
var doc = app.activeDocument;
var myArray = ["usedcolor1", "usedcolor2", "usedcolor3", "usedcolor4", "usedcolor5", "usedcolor6", "usedcolor7", "usedcolor8", "usedcolor9"];
for (var i = 0; i < myArray.length; i++) {
var t = doc.textFrames.getByName(myArray);
var txt = t.contents.replace("PANTONE ", "P.");
t.contents = txt;
}
};
test();