This is the script i am using write now:
app.findTextPreferences.findWhat = NothingEnum.nothing;
app.changeTextPreferences.changeTo = NothingEnum.nothing;
app.findTextPreferences.fontStyle = "Italic"
app.changeTextPreferences.appliedCharacterStyle = "cs_italic";
What the script is exactly doing is if the fontstyle is "Italic" means it automatically apply "cs_italic" style, which i already created in the character style pallette.
But what i want is if the fontstyle is (Italic, Bold) means it automatically create a character style related to their fonts after that apply over their styles.
Thanks in advance.....
Not exactly sure what you're trying to do, but the line in bold is
wrong. Try this:
where myDoc is a reference to the document you working with (often this
will be app.activeDocument )
If your character style is in a group it's a little more complicated:
It's easy if you know how. A ParagraphStyle is part of your document's paragraphStyles property. The paragraphStyles property is of type ParagraphStyles (plural), and that object has a method called 'add': http://jongware.mit.edu/idcsjs5.5/pc_ParagraphStyles.html#add
So to add a paragraph style, you would use
pStyle = app.activeDocument.paragraphStyles.add();
and then set your new style's properties one at a time. The same goes for Character Styles, and for lots of other base document properties as well, from TextFrames to Hyperlinks to Colors.