how to remove or delete empty line space between paragraphs

Explorer ,
Jul 27, 2015 Jul 27, 2015

Copy link to clipboard

Copied

i want to remove or delete empty line space between paragraphs.

and in each page contents should be end in same line at the bottom..

like books...

TOPICS
Scripting

Views

1.0K

Likes

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

correct answers 1 Correct Answer

Engaged , Jul 27, 2015 Jul 27, 2015
#target indesignapp.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;clean_up (app.activeDocument, true);var myDocument = app.activeDocument;//var inddFile = new File ( myDocument.filePath + "/Gardner.indd" );  app.activeDocument.save();  alert ("Clean_up Completed !!!!!!!!!!!!!")//exit();function clean_up (scope, caps){app.findGrepPreferences = app.changeGrepPreferences = null;app.findChangeGrepOptions.includeFootnotes = true;app.findChangeGrepOptions.includeHidden...

Likes

Translate

Translate
Explorer ,
Jul 27, 2015 Jul 27, 2015

Copy link to clipboard

Copied

this is my code... but its not working ..

pagefoot();

function pagefoot()

{

   var doc = app.activeDocument;

   var allpage = doc.pages.everyItem();

   var i;

   //alert(allpage);

  

   doc.pages.everyItem().marginPreferences.bottom = "3";

   doc.pages.everyItem().marginPreferences.top = "3";

   doc.pages.everyItem().marginPreferences.left = "3";

   doc.pages.everyItem().marginPreferences.right = "3";

  

   const height = doc.documentPreferences.pageHeight; 

     //alert(height);    

   var custheight = 66.5;

 

   if(height != custheight)

   {

  

   doc.documentPreferences.pageHeight = custheight;

   }

  

   var allpara = doc.textFrames.everyItem().paragraphs;

   //alert(allpara.length);

 

   for(i=0;i<allpara.length;i++)

   {  

       //alert(allpara.contents);

       try

       {

       if(allpara.contents == "\r")

       {

           //alert("null");

          allpara.remove();

           }

       }

   catch(e)

   {

      

       }

  

       }

  

     

        for(i=0;i<allpara.length;i++)

   {

       try

       {

       if(allpara.contents == " ")

       {

           //alert("hello");

           allpara.remove();

           }

      else

       {

           allpara.spaceBefore = 0;

           }

       }

   catch(e)

   {

       }

       }

  

   //doc.documentPreferences.pageWidth = "51";

  

   //doc.documentPreferences.documentBleedBottomOffset ="3" ;

   // doc.documentPreferences.documentBleedLeftOffset ="3" ;

     

  

}

Likes

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 ,
Jul 27, 2015 Jul 27, 2015

Copy link to clipboard

Copied

#target indesign

app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;

clean_up (app.activeDocument, true);

var myDocument = app.activeDocument;

//var inddFile = new File ( myDocument.filePath + "/Gardner.indd" ); 

app.activeDocument.save(); 

alert ("Clean_up Completed !!!!!!!!!!!!!")

//exit();

function clean_up (scope, caps)

{

app.findGrepPreferences = app.changeGrepPreferences = null;

app.findChangeGrepOptions.includeFootnotes = true;

app.findChangeGrepOptions.includeHiddenLayers = true;

app.findChangeGrepOptions.includeLockedLayersForFind = true;   

app.findChangeGrepOptions.includeLockedStoriesForFind = true;

app.findChangeGrepOptions.includeMasterPages = true;

//app.documents.everyItem().xmlElements.item(0).xmlElements.everyItem().untag();

// series of tabs

change_grep (scope, '\\t\\t+', '\\t');

// series of returns

change_grep (scope, '~b~b+', '~b');

// series of spaces

change_grep (scope, '\\x{20}\\x{20}+', '\\x{20}');

// trailing spaces and tabs

change_grep (scope, '\\s+$', "");

// leading spaces/tabs

change_grep (scope, '^\\s+', "");

change_grep (scope, '~e+', '.~S.~S.');

change_grep (scope, ' . . .', ' .~S.~S.~S.');

}

function change_grep (obj, f, r)

{

app.findGrepPreferences.findWhat = f;

app.changeGrepPreferences.changeTo = r;

obj.changeGrep()

}

Likes

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
New Here ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

Please, How can I apply this script only to selected text and not throughout the document?

Likes

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
Adobe Community Professional ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

Hi Marcelo,

change the code of this line:

clean_up (app.activeDocument, true);

to:

clean_up (app.activeDocument.selection[0], true);

 

FWIW: I only tested this on a small sample of selected text.

It should also work with the text of one single selected text frame.

 

Regards,
Uwe Laubender

( ACP )

Likes

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
New Here ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

LATEST

Nice!!! Works good.
Thank you very much!!!

Likes

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
Explorer ,
Jul 28, 2015 Jul 28, 2015

Copy link to clipboard

Copied

above code is working fine . but i want , each page contents should be end in same line at the bottom..


Likes

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