Copy link to clipboard
Copied
Hi Experts, Please help me with the Code, i dont know what i missed!, it shouid select all Odd pages in the document and assign an Odd Label to it, but it doesnt work!.
(function () {
var myDoc = app.activeDocument;
var myPage = myDoc.pages;
var myFrames = myDoc.textFrames;
for (var i=0; i< myFrames.length ; i++) {
if (myPage.side === PageSideOptions.LEFT_HAND) {
myFrames[i].label ="odd";
}
}
}());
Thanks in Advance
Best Regards
M.Hasanain
FWIW: Also discussed and solved in this thread:
Assign Script Label to Odd Pages Trying to Exclude Text Frames in Master page
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thank you alot, Actually the reason of naming the left page (odd) is that document is Right to left Document Becuase i use InDesign ME Support Arabic and Hebrew and Both Languages Writtened from Right to Left(RTL Document), I'm Beginner in Programming JavaScript, Actually I Need your advice about InDesign DOM, Because i have Difficulties with Understanding How to Catch Porperties and Values in sequence in the JavaScript Code, I need a Road Map Guide (Some Rules) in Connecting the Chain of the Codes, in the Example (MyFrames) will equal :
MyFrames = app.activeDocument.textFrames (i Understand that in InDesign DOM) its important to follow the Hierarchy of Commands, But a lot of times i got lost! and confused, can you tell me how to Overcome this problem to be a better coder with InDesign JavaScript and Thank you a lot, I learend a lot today.
Best Regards
M.Hasanain
Copy link to clipboard
Copied
FWIW: Also discussed and solved in this thread:
Assign Script Label to Odd Pages Trying to Exclude Text Frames in Master page
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
You could also assign a label to the page object itself.
This is even possible in the GUI with the Script Label panel, if pages are selected with the Page tool:
And if you ask for a specific value for textFrame.parentPage you could directly see if the text frame is left from the spine.
alert( app.selection[0].parentPage.label );
Note: parentPage will return null if the object is on the pasteboard.
Hm. The more I think about it…
If you test for side you only test for left or right from the spine. If a given page is an odd or even page is a bit fuzzy, it could be a matter of page naming and also important is the number of pages left or right from the spine. There could be up to 10 pages in one spread.
Regards,
Uwe Laubender
( ACP )