Trouble applying paragraph and character styles to text in Illustrator with a script
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 |
