• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Remove extra enter mark by script

Participant ,
May 24, 2014 May 24, 2014

Copy link to clipboard

Copied

Hi,

I need to remove extra enter mark in my Indesign file, at the same time it should not be affect the above and below styles.

by

hasvi

TOPICS
Scripting

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 24, 2014 May 24, 2014

Copy link to clipboard

Copied

Do you mean find:

~b~b+

replace with:

\r

You can use this predefined search in ID out-of-box.

or what do you mean???

(If not this, sceenshot with visible hidden characters and more informations please.)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 24, 2014 May 24, 2014

Copy link to clipboard

Copied

Thanks its working

Sent from Yahoo Mail on Android

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 27, 2014 May 27, 2014

Copy link to clipboard

Copied

Hi,

app.findGrepPreferences.findWhat = "~b~b+";

app.changeGrepPreferences.changeTo ="\r";

app.activeDocument.changeGrep ();

This script is working for remove extra enter mark in Indesign file, but when its removed that time the enter mark followed para style was changed.

I want to remove the enter mark at the same time I have retained followed para style. Is this possible by script?

by

hasvi

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 27, 2014 May 27, 2014

Copy link to clipboard

Copied

@Hasvi – the script by pixxxelschubser is working.

We need a screenshot with hidden characters showing (a before and after comparison) where it is not working. As I said, for me it is working.

You can include a screenshot with the forum software by using the camera icon:

HowToInsertScreenShot.png

And with showing hidden characters I mean something like this:

Before running the script:

Before.png

After running the script:

After.png

Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 27, 2014 May 27, 2014

Copy link to clipboard

Copied

Its working fine in non xml file. But its not working in xml file. You need xml file sample?

Sent from Yahoo Mail on Android

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 27, 2014 May 27, 2014

Copy link to clipboard

Copied

@Hasvi – ah, now!
A sample would be fine… There should be a solution 😉

Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 27, 2014 May 27, 2014

Copy link to clipboard

Copied

@hasvi – I did not realise, that you entered another post before for the same issue. Think, you could have mentioned it. Now it's not necessary to send a new screenshot.

Seems to be best to continue this conversation over there:

hasvi

correct my script 'clear empty enter mark'

May 27, 2014 5:26 AM

https://forums.adobe.com/thread/1483275

Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 28, 2014 May 28, 2014

Copy link to clipboard

Copied

@hasvi

Try this,

var myDoc = app.activeDocument;

app.findGrepPreferences = NothingEnum.nothing;

app.changeGrepPreferences = NothingEnum.nothing;

app.findGrepPreferences.findWhat = "\\r+(?<=\\r)\s*$";

app.changeGrepPreferences.changeTo = "";

app.activeDocument.changeGrep();

app.findGrepPreferences = NothingEnum.nothing;

app.changeGrepPreferences = NothingEnum.nothing;

app.findGrepPreferences.findWhat = "^\r";

app.changeGrepPreferences.changeTo = "";

app.activeDocument.changeGrep();

Hurix

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 28, 2014 May 28, 2014

Copy link to clipboard

Copied

hi hurix,

its working fine, but 'app.findGrepPreferences.findWhat = "^\r";' this statement is not retain the paragraph style.

by

hasvi

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 28, 2014 May 28, 2014

Copy link to clipboard

Copied

It's recognize Beginning of the character.

Hurix

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 28, 2014 May 28, 2014

Copy link to clipboard

Copied

anyhow thanks hurix

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 17, 2023 Mar 17, 2023

Copy link to clipboard

Copied

Hi Hasvi,

 

You can use this one.

var myDoc = app.documents[0];
app.findGrepPreferences = app.changeGrepPreferences = null;

try {
    app.findGrepPreferences.findWhat = "^\\r";
    app.changeGrepPreferences.changeTo = "";
    var found_enter_mark = myDoc.findGrep();

    for (var i = found_enter_mark.length - 1; i >= 0; i--) {
        var first_paragraph = found_enter_mark[i].paragraphs.firstItem();
        var next_paragraph = first_paragraph.paragraphs[-1].insertionPoints[-1].paragraphs[0];
        first_paragraph.appliedParagraphStyle = next_paragraph.appliedParagraphStyle;
    }
    myDoc.changeGrep();
}
catch (e) { }

app.findGrepPreferences = app.changeGrepPreferences = null;
-Sumit

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 17, 2023 Mar 17, 2023

Copy link to clipboard

Copied

Hi @SumitKumar , It’s easy to miss, but this thread is 9 years old, so I doubt @hasvi is going to see your reply.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 17, 2023 Mar 17, 2023

Copy link to clipboard

Copied

LATEST

Goes for me, too 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 17, 2023 Mar 17, 2023

Copy link to clipboard

Copied

You get the problems with changing styles because of the \r that's replaced. So you should leave alone the first \r in a series  and remove any following ones. You can do this with the following query:

Find what: \r\K\r+

Change to: <leave empty>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines