Copy link to clipboard
Copied
Hi All,
How to find and report the hidden text frames, example the below text frame behind the rectangle frame.
Note: we must ignore the grouped, anchored and wrap objects.
The below sample is not working
//An InDesign file with two objects on the same page,
//one text frame and one rectangle that holds an image.
var d=app.documents[0];
var myImageContainerDup = d.allGraphics[0].parent.duplicate();
var myTextFrameDup = d.textFrames[0].duplicate();
//Make a selection:
app.select([myImageContainerDup,myTextFrameDup]);
//ID for New MultiStateObject: 83621
//Adding a MultiStateObject (MSO) with the two selected objects:
try{app.scriptMenuActions.itemByID(83605).invoke()}catch(e){alert(e);$.writeln("Something went wrong!");exit()};
//The object in the front goes to state 1
//The object in the back goes to state 2
var myMSO = d.multiStateObjects[-1];
//State 1
$.writeln("Front:"+"\t"+myMSO.states[0].groups[0].pageItems[0].getElements()[0].constructor.name); //=> "TextFrame" if text frame is in front
//State 2
$.writeln("Back:"+"\t"+myMSO.states[1].groups[0].pageItems[0].getElements()[0].constructor.name); //=> "TextFrame" if text frame is in the back
Thanks in advance,
Selva
Copy link to clipboard
Copied
Hi Selva,
what exactly is not working?
Building the MSO ?
If you are working with selected objects and a menu action you should have the MSO panel open:
app.panels.itemByName("$ID/$$$/Panel/MSOPanel").visible = true;
Or is the problem to get the right order of page items in a certain state?
For the first state of the first MSO in an document this will return an array of page items in stacking order:
app.documents[0].multiStateObjects[0].states[0].pageItems[0].allPageItems
Regards,
Uwe
Copy link to clipboard
Copied
Or do you want to get the pageItems in the active state of an MSO?
Then check the value of activeStateIndex of the MSO.
var myMSO = app.documents[0].multiStateObjects[0];
var activeStateIndex = myMSO.activeStateIndex;
myMSO.states[activeStateIndex].pageItems[0].allPageItems;
Regards,
Uwe
Copy link to clipboard
Copied
Hi Uwe,
Thanks for the guidance.
Sorry i'm going completely wrong way based on my previous code. Because, I check only the hidden text frame in every pages (behind from rectangle or graphic).
Kindly guide to me.
Thanks,
Selva
Copy link to clipboard
Copied
Sorry. I simply don't get what you are after…
Are you talking about MSOs or not?
Regards,
Uwe
Copy link to clipboard
Copied
selvam214 wrote:
… Because, I check only the hidden text frame in every pages (behind from rectangle or graphic).
If you are still talking about a text frame in an MSO that is not in the active state of that MSO, it is not "hidden" technically if you refer to the property "visible" of text frames. There is no property "hidden" for text frames. There is an object "hiddenText", but that belongs to a different realm: Conditional Text.
So you see: I simply have no clue what you are talking about.
Regards,
Uwe
Copy link to clipboard
Copied
Hi,
let me explain you clearly about my problem.
I want to find out the object frames under which a text frame is available. In the second image which i have already sent, you may find a object frame in green color under which a text frame is available. this needs to be shown as error.
please guide me and let me know if still it is unclear.
Thanks,
Selva
Copy link to clipboard
Copied
Is this right answer. I have the same query like to find hidden textframe behind (Rectangle or Images). So Please can you share right scripting.
Thanks,
Sangeetha.K