Copy link to clipboard
Copied
Hi
I have an indesign file that contain 3 different designs distrubuted along 100 pages , I have 2 paragraph styles for each design
I want a script to apply certain paragraph styles on text frames of certain pages Not All pages in the File
Ex : Paragraph style (1) from page 1 to 10 , Paragraph style (2) from page 1 to 10
Paragraph style (3) from page 11 to 15 , Paragraph style (4) from page 11 to 15
Can I do that by a script ???
/*
by FRIdNGE, Michel Allio [01/02/2023]
*/
var myDoc = app.activeDocument,
myPages = myDoc.pages;
// "O" is the first page; "4" is the 5st page.
for ( var p = 0; p < 4; p++ ) {
var myTFrames = myPages[p].textFrames;
// "myTFrames[1]" is the first text frame created on the page;
// "myDoc.paragraphStyles.item("1")" is the name ("1") of the para style to be applied;
// "myTFrames[0]" is the second text frame created on the page;
// "myDoc.paragraphStyles.item("2")" is the nam
...
… So if you want "pages 1-4", write this line:
… if you want "pages 5-9", write this line:
(^/)
Copy link to clipboard
Copied
Any Help Here
Copy link to clipboard
Copied
Hi,
Yes, you can do it by Script (with more infos)!
(^/) The Jedi
Copy link to clipboard
Copied
Thanks for Your Reply
After your permission can you write this script and post it here ?
Copy link to clipboard
Copied
It took me 4 min. to do it with 3 Grep F/R! [100 pages ID file creation, Regex writing + Test]
Sure it would take you just 1 second with a Script! (considering the Script time as 0.)
(^/)
Copy link to clipboard
Copied
Sorry , I can't understand
Can you explain or write full script .jsx that can I put it in scripts folder
Copy link to clipboard
Copied
@FRIdNGEyou say using with GREP style?
Copy link to clipboard
Copied
No, basic F/R supposing there's 1 story!
(^/)
Copy link to clipboard
Copied
but...
ii) Are the texts in different TextFrames or are they a single story?
ii) the texts in different TextFrames not a single story
I also thought of next style but @r28071715i111 said "not a single story".
but it is also possible to create shortcut keys for the styles and nothing that a few manual minutes can't solve the issue. Thinking of just one document.
Copy link to clipboard
Copied
In your example you went from ParagraphStyle(1) to (4). But in the post you mention applying only 2 per page. OK
So your scenario is?
a) the document has 4 different styles;
b) the application takes place in defined ranges;
I would like to think about:
i) How many text boxes are there on each page? Is it a fixed amount throughout the document?
ii) Are the texts in different TextFrames or are they a single story?
iii) The current demand pages are sequential and with a defined "step", like 5 by 5, 10 by 10 pages...
iv) it is certain that there is only one paragraph that uses the same style. I mean can it happen that two paragraphs on the page use the same style?
Can you post a screenshot of your layout or share some kind of preview of your context?
Copy link to clipboard
Copied
Thanks For Reply ... that is in the document
a) the document has 6 different styles ... 2 styles for each design of the 3 designs
b) the application takes place in defined ranges ( True ) ... I want styles for certain pages from page .... to page ....
i) There are only 2 text frames in each page throughout the document
ii) the texts in different TextFrames not a single story
iii) The current demand pages are sequential like 1 by 1 ( Ex : From page 1 to 5 )
I mean only pages 1 , 2 , 3 , 4 , 5 Not other pages
iv) Noooooooo , I want for example the first paragraph style apply only on one text frame Not one the two frames
Copy link to clipboard
Copied
there are a screenshot of the 3 designs and the paragraph styles that i want to apply it on each design
From Page 1 to 8 ... Use Name 1 and Class 1 styles
From Page 9 to 49... Use Name 2 and Class 2 styles
From Page 50 to 100 ... Use Name 3 and Class 3 styles
Copy link to clipboard
Copied
Very nice of you to share your context. There's a lot involved in this layout. It is possible to make a script but maybe the work is not worth it, unless you have thousands of these to do.
I would think of variable data (Window >> Utilities >> Data Merge), DataMerge, to apply these names there. With a little organization of the CSV base and the indesign template, you can solve this much easier than creating/generating a script just for this.
At least that's one of the ways I would go:
1) prepare the CSV file with the data (separating into files according to the pair of styles to be applied);
2) prepare the art/matrix in indesign (one for each pair of styles to be applied);
3) would rotate the variable data;
Copy link to clipboard
Copied
This indesign file already I created using data merge by using csv file and first design and I replaced this design graphic frames with the two other designs ( in links Panel ) along the whole pages
I want to Script instead of creating data merge 3 times seperately .. one time for each design and then merge the 3 indesign files in one document
Are you understand me ?
Copy link to clipboard
Copied
/*
by FRIdNGE, Michel Allio [01/02/2023]
*/
var myDoc = app.activeDocument,
myPages = myDoc.pages;
// "O" is the first page; "4" is the 5st page.
for ( var p = 0; p < 4; p++ ) {
var myTFrames = myPages[p].textFrames;
// "myTFrames[1]" is the first text frame created on the page;
// "myDoc.paragraphStyles.item("1")" is the name ("1") of the para style to be applied;
// "myTFrames[0]" is the second text frame created on the page;
// "myDoc.paragraphStyles.item("2")" is the name ("2") of the para style to be applied;
myTFrames[1].paragraphs[0].appliedParagraphStyle = myDoc.paragraphStyles.item("1");
myTFrames[0].paragraphs[0].appliedParagraphStyle = myDoc.paragraphStyles.item("2");
}
alert( "Done!…" )
Copy link to clipboard
Copied
… So if you want "pages 1-4", write this line:
… if you want "pages 5-9", write this line:
(^/)
Copy link to clipboard
Copied
Very Big Great Thanks For You
I tried it and worked as charm
Thank you very very much
Copy link to clipboard
Copied
Hi FRIdNGE!
I have a very similar question. I have a book of 4 signatures, with text spanning the entirety of the book. I want to use a different paragraph style for each signature, but the text should remain continuous. What would a script look like that basically says:
Find more inspiration, events, and resources on the new Adobe Community
Explore Now