Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to apply 'Paragraph Styles' into a Script? need help!

Status
Not open for further replies.

ITCoordinatorStraus

IS-IT--Management
Nov 21, 2010
1
US
Hello,



I'm in Need of a Script for InDesign Cs3. I'm not new to programming. I know VB, C++ and Assmbler. I'm rather new to Javascript though, and just don't know all the syntex commands.



I would like a script that applies a Paragraph style to a document in indesign. But I would like the script ot apply this same paragraph style ot each paragraph on the document. Is there a way to let the script know to stop at the end of the text window, so that it doesnt make the text of the paragraphs exceed the page's size?



I wrote this script so far, It applies the 'Paragraph Style' to one paragraph, but I want it to apply to all the text in the word box on one page at a time. I'm just not sure how to make it apply to more than one paragraph with the style. Basically 'Thursday' and 'November 11' happens only once at the top of the page, but the paragraph style stays the same for every paragraph. 'Thursday' and 'Novmeber 11' are generic, each week it be a different day of the week and date of the given month, is there a way for the script to differ between dates and days?



var myDoc = app.documents[0]
var mySel = app.selection[0]
var myHolidayStyle1 = "Holiday"
//var myHolidayStyle2 = "Normal";



mySel.appliedParagraphStyle = myDoc.paragraphStyles.item (myHolidayStyle1);
mySel.paragraphs[-1].insertionPoints[-1].paragraphs[0];





I'm relatively New to Paragraph Styles too, so I'm hoping that will be simplier to do than to make the script, and maybe that for another prt of the forum, But I' just like to get the script part done. The Paragraph Style would be called "Holiday".I made this Paragraph style after hours of trial and error, now I just need to know how to apply multiple styles to a page and have those styles be consistent with each page. I work for a Newspaper company, so this has to be accurate and work.



This is an example of what the Paragraph header would look like:



Thursday (present LT std. Black 22pt)



November 11 (Palatino Linotype Bold 10 pt)


Title of article: text goes here, bla bla bla
blablablablabl bla bla bla bla bla bla (Palatino LT std Roman 9 pt)
bla bla bla bla bla bla bla bla bla
bla bla bla bla bla bla. (end of Paragraph)




(next paragraph)
Title of article: text goes here, bla bla bla
blablablablabl bla bla bla bla bla bla
bla bla bla bla bla bla bla bla bla
bla bla bla bla bla bla.



repeat



repeat




Any help would be greatly appreciated. I would really like get a understand of how it should look like in the script, if someone could help me, that be wonderful.



Thank You.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top