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

Remove extra enter mark by script

Participant ,
May 24, 2014 May 24, 2014

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
1.6K
Translate
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

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.)

Translate
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

Thanks its working

Sent from Yahoo Mail on Android

Translate
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

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

Translate
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

@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

Translate
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

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

Translate
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

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

Uwe

Translate
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

@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

Translate
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

@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

Translate
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

hi hurix,

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

by

hasvi

Translate
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

It's recognize Beginning of the character.

Hurix

Translate
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

anyhow thanks hurix

Translate
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

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
Translate
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

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

Translate
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
LATEST

Goes for me, too 🙂

Translate
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

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>

Translate
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