Copy link to clipboard
Copied
Hi all,
I have doubt in create a paragraph style or character style using javascript.
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";
app.documents.item(0).changeText();
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.
I am new to forum and javascript.
Thanks in advance.....
Copy link to clipboard
Copied
Not exactly sure what you're trying to do, but the line in bold is
wrong. Try this:
app.changeTextPreferences.appliedCharacterStyle =
myDoc.characterStyles.itemByName("cs_italic");
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:
myDoc.characterStyleGroups.itemByName("myGroupName").characterStyles.itemByName("cs_italic");
Ariel
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Hi.
I need a script that create a character style with these proprieties:
General / Based [none]
Basic Character Formats [none]
Advanced Character Format / Language [no language]
Character Color [none]
Open Type Features [none]
Underline Options [none]
Strikethrough [none]
Export tagging / ePUB and HTML / Tag [automatic]
Could you help me?
Copy link to clipboard
Copied
Could you pay somebody for that?
(^/)
Copy link to clipboard
Copied
You will find everything you need to know..
Copy link to clipboard
Copied
Hi.
I need a script that create a character style with these proprieties:
General / Based [none]
Basic Character Formats [none]
Advanced Character Format / Language [no language]
Character Color [none]
Open Type Features [none]
Underline Options [none]
Strikethrough [none]
Export tagging / ePUB and HTML / Tag [automatic]
Is it possible?
Anywhere can help me?