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...
#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.includeHidden
...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" ;
}
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()
}
Copy link to clipboard
Copied
Please, How can I apply this script only to selected text and not throughout the document?
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 )
Copy link to clipboard
Copied
Nice!!! Works good.
Thank you very much!!!
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..