Copy link to clipboard
Copied
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
app.findGrepPreferences.appliedParagraphStyle = String(dropdown1.selection);
app.findGrepPreferences.findWhat = "\\r";
var foundItems = app.activeDocument.findGrep(true);
app.changeGrepPreferences.changeTo = "";
app.activeDocument.changeText ( );
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
I am trying to remove this end of paragraph symbol(due to this i am getting new empty line)!
Copy link to clipboard
Copied
Your code looks fine. What issue are you seeing? Check if the value of the dropdown selection is correct or not
-Manan
Copy link to clipboard
Copied
Hi Karthic,
try this pattern:
findWhat = "\\r+\\Z";
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
@Laubender this grep is also working! thanks for your response!
Copy link to clipboard
Copied
But this replaces content. If the paragraph contains any formating, it's more than likely to get messed up. Better to use something like this:
// Assuming a story
while (myStory.characters[-1].contents == '\r') {
myStory.characters[-1].contents = '';
}
Copy link to clipboard
Copied
instead of changeGrep "app.activeDocument.changeGrep ( );",i coded as changeText "app.activeDocument.changeText ( );", Now its working fine! thanks for your response!
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
app.findGrepPreferences.appliedParagraphStyle = String(dropdown1.selection);
app.findGrepPreferences.findWhat = "\\r";
app.changeGrepPreferences.changeTo = "";
app.activeDocument.changeGrep( );
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
Copy link to clipboard
Copied
findWhat = "\\r";
in combination with:
changeTo = "";
app.activeDocument.changeGrep( );
would remove every end of paragraph character that is formatted with the selected paragraph style in your document. Not only the one that is at the end of a story or at the end of a text cell.
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
@Laubender Yes, you are absolutely right but it works fine for my purpose! thanks for your time!
Copy link to clipboard
Copied
Hi @Karthik SG , just to clarify are you trying to remove the paeragraph return or the end of story invisible (#)?
Removing the return I would expect this:
app.findGrepPreferences.findWhat=NothingEnum.NOTHING
app.changeGrepPreferences.changeTo=NothingEnum.NOTHING
app.findGrepPreferences.findWhat = "\\r";
app.changeGrepPreferences.changeTo = "";
app.activeDocument.changeGrep()