: Script for applying paragraph and character styles in illustrator I've been trying to manipulate the sample scripts from ADOBE ILLUSTRATOR CC SCRIPTING REFERENCE: JAVASCRIPT without any success (I
I've been trying to manipulate the sample scripts from ADOBE ILLUSTRATOR CC
SCRIPTING REFERENCE: JAVASCRIPT without any success (I am brand new to JavaScript). I would like to be able to find specific text in an Illustrator document and apply paragraph and character styles with a script. I would like to be able to automate this feature with a batch for multiple documents. Any help would be appreciated!
More posts by @Karen819
1 Comments
Sorted by latest first Latest Oldest Best
I suggest for you to check out the Illustrator scripting forum if you would like to learn more about Illustrator scripting. Besides being populated with all people who do scripting for Illustrator, they also have syntax highlighting in the forum.
Anyway, here is an example snippet:
//@target illustrator
function test(){
var doc = app.activeDocument;
var myFrame = doc.textFrames.getByName("MyText");
var myStyle = doc.characterStyles.getByName("MyStyle");
myStyle.applyTo(myFrame.textRange);
};
test();
Here you can see that it's grabbing a textbox based on its name in the layers panel and it's getting an existing character style the same way. There are other ways to get at those objects when you don't know the name too. The character style object has an 'applyTo' command, but it doesn't just take a text box as the input, it actually takes a 'textRange' object of the text frame items (of which there can be several sub-text-ranges). In this example it's just applying the style to the entire text box, but you can use text matching operations to isolate only certain words or manipulate other textFrame properties such as the paragraphs and lines of text to apply styles to them.
In order to really explain the can of worms that's Illustrator scripting text api it is kind of a lot for someone just starting out, so I hope this is a good start for you.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.