Copy link to clipboard
Copied
I am trying to figure out how to apply paragraph and character styles to text in Illustrator with a script. I have pieced together this and it works sort-of. But I run into the problem that if searchWord1 = "CAUTION:"; with the colon it doesn't work. The same goes for searchWord1 = "¡CUIDADO!:"; I'm assuming it is because of the punctuation? How do I fix this? var doc = app.activeDocument; var myFrame = doc.textFrames.getByName("back-info"); var myStyle = doc.paragraphStyles.getByName("bullets"); myStyle.applyTo(myFrame.textRange); if ( app.documents.length > 0 && app.activeDocument.textFrames.length > 0 ) { searchWord1 = "CAUTION"; for ( i = 0; i < app.activeDocument.textFrames.length; i++ ) { textArt = activeDocument.textFrames; for ( j = 0; j < textArt.words.length; j++) { word = textArt.words |
Here, from the link I posted in previous thread, an altered version of pixxxel's script:
#target illustrator
function test(){
// regex_changeContentsOfWordOrString_RemainFormatting.jsx
// regards pixxxel schubser
var doc = app.activeDocument;
var s = new RegExp("CAUTION:", "gi");
var myStyle = doc.characterStyles.getByName("MyStyle");
var atf = activeDocument.textFrames[0];
while (result = s.exec(atf.contents)) {
try {
aCon = atf.characters[result.index];
aCon.length = re
...Copy link to clipboard
Copied
Here, from the link I posted in previous thread, an altered version of pixxxel's script:
#target illustrator
function test(){
// regex_changeContentsOfWordOrString_RemainFormatting.jsx
// regards pixxxel schubser
var doc = app.activeDocument;
var s = new RegExp("CAUTION:", "gi");
var myStyle = doc.characterStyles.getByName("MyStyle");
var atf = activeDocument.textFrames[0];
while (result = s.exec(atf.contents)) {
try {
aCon = atf.characters[result.index];
aCon.length = result[0].length;
myStyle.applyTo(aCon);
} catch (e) {};
}
};
test();
Copy link to clipboard
Copied
Copy link to clipboard
Copied
anybody can share video tut on this, nothing happen while using, how to use?