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

Please Help me fixing old script by Harb

Enthusiast ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

Hi Experts,

i use Harb Script found here in the forum and in his website (  ) , here is the code :

"http://in-tools.com/article/scripts-blog/separate-pages-script/"

 

 

/*****************************************************
SeparatePages.jsx
An InDesign CS2 javascript by Harbs.
For more scripts and automation tools visit www.in-tools.com.

Will separate all pages to allow for inner bleeds
while preserving the original orientation of the page.
Basic testing done on CS2 ME. (Should work with CS and CS3 also, but untested.)
Use at your own risk!!!
*******************************************************/
aDoc = app.activeDocument;
for (i=0;i<aDoc.pages.length;i++){
	aSide = aDoc.pages[i].side;
	aSide = aSide + "";
	aDoc.pages[i].insertLabel("direction",aSide);
	}
aDoc.documentPreferences.allowPageShuffle = true;
aDoc.documentPreferences.facingPages = false;
aDoc.documentPreferences.allowPageShuffle = false;
aDoc.documentPreferences.facingPages = true;
for (i=0;i<aDoc.pages.length;i++){
	myPage = aDoc.pages[i];
	mySide = myPage.extractLabel("direction");
	if (mySide == "1818653800"){
		myPage.move(LocationOptions.atEnd,myPage,BindingOptions.leftAlign);
		}else{
		myPage.move(LocationOptions.atEnd,myPage,BindingOptions.rightAlign);
		}
	}

 

 

i see after running the script that the splitted pages have items moved to the left (images and text frames), that including images and text frame!, I don't know why, no error messages! but it moves to left, thats mean vandalize the document!

Please can you help me to identify the problem, i still learning javascript so i can't figure where is the problem?, here is screen shots.

After Applying Seperate Pages Script.jpgOriginal Pages Before Seperating.jpg

Thanks in Advance

Best 

M.Hasanain

Best
Mohammad Hasanin
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

correct answers 1 Correct answer

Enthusiast , May 06, 2021 May 06, 2021

Hi Laubender,

Thanks a lot, I read all the Articles thoroughly!, especially the one with you and kasyan discussing the treatment for shifting items after numbering here (https://community.adobe.com/t5/indesign/bug-in-book-s-update-numbering-feature/m-p/10768770?page=1#M166153), and i found a good solution, i just add the two lines for locking and unlocking items in the document and it works!

 

/*****************************************************
SeparatePages.jsx
An InDesign CS2 javascript by Har
...

Votes

Translate

Translate
Community Expert ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Did you ask Harbs?

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
Enthusiast ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Hi Mr.Peter,

Yes, I Wrote on the Script page

http://in-tools.com/article/scripts-blog/separate-pages-script/

Best
Mohammad Hasanin

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 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Hi M. Hasanain,

this is a known bug with InDesign.

 

Solution:

Before running the script, set the inner and outer margin values of all pages to the exact same amount.

 

Regards,
Uwe Laubender

( ACP )

 

//EDITED

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
Enthusiast ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Thank you a lot, Can this be done by code?

Best
Mohammad Hasanin

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
Enthusiast ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

i do it (Inside and Outside) but Problem Still exist!

inner-outer margin.jpg

Best
Mohammad Hasanin

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 05, 2021 May 05, 2021

Copy link to clipboard

Copied

"Problem Still exist"

 

Hm. Perhaps try a different value like 0 for all margins.

How did you apply the new margin values? Through master pages?

 

If value 0 for all margins is not working, I need the InDesign document to tell more.

 

FWIW: Kasyan Servetsky did an article about a similar problem, shifting items on the page, with a scripting solution:

http://kasyan.ho.ua/indesign/2020/check_pageitems_for_shift/check_pageitems_for_shift.html

 

Regards,
Uwe Laubender

( ACP )

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
Guide ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Just:

 

aDoc = app.activeDocument;
for (i=0;i<aDoc.pages.length;i++){
	aSide = aDoc.pages[i].side;
	aSide = aSide + "";
	aDoc.pages[i].insertLabel("direction",aSide);
	}

aDoc.documentPreferences.allowPageShuffle = true;
aDoc.documentPreferences.facingPages = false;

for (i=0;i<aDoc.pages.length;i++){
	myPage = aDoc.pages[i];
	mySide = myPage.extractLabel("direction");
	if (mySide == "1818653800"){
		myPage.move(LocationOptions.atEnd,myPage,BindingOptions.leftAlign);
		}else{
		myPage.move(LocationOptions.atEnd,myPage,BindingOptions.rightAlign);
		}
	}

aDoc.documentPreferences.allowPageShuffle = false;
aDoc.documentPreferences.facingPages = true;

 

(^/)  The Jedi

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
Enthusiast ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Thanks FRIdNGE for the Update, But Actually the Problem is Still Exist!, I found if the Doc are (LTR) so the  Right Hand Pages items need to be Shifted -5mm and if the Doc are (RTL) so the Left Hand Pages items need to be Shifted 5mm!, So the Problem is still exist.

five mm shifting.jpg

Best
Mohammad Hasanin

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
Enthusiast ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Hi Laubender

I tried to Make all the Margins (0) in all (Top-Bottm-Inside-Outside) and yes from the master but the problem still exist!, i will see kasyan solution for shifting items, thank you

Best
Mohammad Hasanin

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 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Hi M.Hasanain,

now I found this thread from 2016:

 

Script to move a facing page after itself?
JustyR, Nov 12, 2016
https://community.adobe.com/t5/indesign/script-to-move-a-facing-page-after-itself/td-p/8659149

 

There is no real news in it, but the one that moving items is nothing new when shifting pages to their own spreads using a script. If you do this "by hand" in the user interface it should work as expected.

 

Regards,
Uwe Laubender

( ACP )

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
Enthusiast ,
May 06, 2021 May 06, 2021

Copy link to clipboard

Copied

Hi Laubender,

Thanks a lot, I read all the Articles thoroughly!, especially the one with you and kasyan discussing the treatment for shifting items after numbering here (https://community.adobe.com/t5/indesign/bug-in-book-s-update-numbering-feature/m-p/10768770?page=1#M...), and i found a good solution, i just add the two lines for locking and unlocking items in the document and it works!

 

/*****************************************************
SeparatePages.jsx
An InDesign CS2 javascript by Harbs.
Updated By : M.Hasanain
Special Thanks to : Kasyan Servetsky  and  Laubender 
For more scripts and automation tools visit www.in-tools.com.

Will separate all pages to allow for inner bleeds
while preserving the original orientation of the page.
Basic testing done on CS2 ME. (Should work with CS and CS3 also, but untested.)
Use at your own risk!!!

*******************************************************/
//-----------------------------------------------------------------------------------------------------
// WARNING: Here we do not bother if some items are already locked before 
// and should stay locked after unlocking all again:
app.documents[0].pageItems.everyItem().locked = true;
//-----------------------------------------------------------------------------------------------------
aDoc = app.activeDocument;
for (i=0;i<aDoc.pages.length;i++){
	aSide = aDoc.pages[i].side;
	aSide = aSide + "";
	aDoc.pages[i].insertLabel("direction",aSide);
	}
aDoc.documentPreferences.allowPageShuffle = true;
aDoc.documentPreferences.facingPages = false;
aDoc.documentPreferences.allowPageShuffle = false;
aDoc.documentPreferences.facingPages = true;
for (i=0;i<aDoc.pages.length;i++){
	myPage = aDoc.pages[i];
	mySide = myPage.extractLabel("direction");
	if (mySide == "1818653800"){
		myPage.move(LocationOptions.atEnd,myPage,BindingOptions.leftAlign);
		}else{
		myPage.move(LocationOptions.atEnd,myPage,BindingOptions.rightAlign);
		}
	}
//-----------------------------------------------------------------------------------------------------
// WARNING: Here we do not bother if some items were already locked before 
// and should stay locked after unlocking all again:
app.documents[0].pageItems.everyItem().locked = false;
//-----------------------------------------------------------------------------------------------------

 

 

Best
Mohammad Hasanin

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
Guide ,
May 06, 2021 May 06, 2021

Copy link to clipboard

Copied

I’ve tried Gabe Harbs’ script corrected as I said on InDesign CS6 and CC 2019 on RTL and LTR docs and it works correctly! 

 

(^/)

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
Enthusiast ,
May 06, 2021 May 06, 2021

Copy link to clipboard

Copied

LATEST

Maybe its a bug in InDesign 2020 and 2021!, Thanks for testing.

Best
Mohammad Hasanin

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