Copy link to clipboard
Copied
Hello.
My problem is the following:
I have a text with headlines, sublines, copytext etc.
All elements are assigned with paragraphstyles.
The copytext has an intend in the first line.
My problem is, how can I automate/grep it, that every first paragraph has NO intend in the first line.
Example:
HEADLINE
COPY NO INTEND TEXT TEXT
TEXT TEXT TEXT.
INTEND TEXT TEXT TEXT
TEXT TEXT TEXT TEXT.
INTEND TEXT TEXT TEXT
TEXT TEXT TEXT TEXT.
COPY NO INTEND TEXT TEXT
TEXT TEXT TEXT.
INTEND TEXT TEXT TEXT
TEXT TEXT TEXT TEXT.
INTEND TEXT TEXT TEXT
TEXT TEXT TEXT TEXT.
Thank you.
Copy link to clipboard
Copied
This is, how it should look like.
Copy link to clipboard
Copied
Hi,
Try this code:
var myDoc=app.documents[0];
// list your Head levels
app.findTextPreferences = null;
app.findTextPreferences.appliedParagraphStyle = app.documents[0].paragraphStyles.item("H1"); // change your head style
list = app.documents[0].findText(0);
// For each found item
for (i=0; i<list.length; i++)
{
// a. Check the *next* paragraph for your body text
if (list.paragraphs.nextItem(list.paragraphs[0]).appliedParagraphStyle == app.documents[0].paragraphStyles.item("para")) // change your paragraph style
// b. If so, remove indent
list.paragraphs.nextItem(list.paragraphs[0]).firstLineIndent = 0;
}
Thanks,
Prabu
Copy link to clipboard
Copied
Hi Prabu!
Nice! Personal use:
var myDoc = app.activeDocument;
app.findGrepPreferences = null;
app.findGrepPreferences.appliedParagraphStyle = "H1";
myFound = myDoc.findGrep();
var F = myFound.length;
for ( var f = 0; f < F; f++ ) {
var myNext = myFound
.paragraphs.nextItem( myFound .paragraphs[0] ); if ( myNext.isValid && myNext.appliedParagraphStyle.name == "Para" ) {
myFound
.paragraphs.nextItem( myFound .paragraphs[0] ).firstLineIndent = 0; }
}
Note the modification on line 08!
(^/)
Copy link to clipboard
Copied
Hi Obi,
Thanks a lot for helping me...
It will help and motivate the new beginners and developers.
Thanks
Prabu
Copy link to clipboard
Copied
Hello together and thanks to all of you. it works ...