Thread View: adobe.scripting.indesign
3 messages
3 total messages
Started by Tomasz_Bujlow
Sat, 14 Feb 2009 16:43
TextFrames and Stories - what am I doing wrong?
Author: Tomasz_Bujlow
Date: Sat, 14 Feb 2009 16:43
Date: Sat, 14 Feb 2009 16:43
17 lines
1474 bytes
1474 bytes
Hi,
I have got problem with TextFrames and Stories in InDesign. So, I am executing this script:
var myFrame = app.selection[0];
var myStory = myFrame.parentStory;
myID = myStory.id;
alert("Sel: " + myID);
alert("Story id: " + myStory.textFrames.length);
First of all I'm getting handle to selected textFrame, then I am getiing handle and ID of Story, which contain this textFrame. Everything here works fine and we get here proper Story ID. But, when I execute the last line, I always get length=0. Why? If I selected a textFrame, which is a part of the story (I got the parentStroy attibute), the "length" in the last line should be always at least 1. But this is 0. I cannot understand why.
So, how can I get all textFrames which belong to the story? I could admit, that when I execute this line:
myStory.exportFile(myFormat, myFile);
the content of the textFrame is put to file (like expected)....
Re: TextFrames and Stories - what am I doing wrong?
Author: Dave_Saunders
Date: Sat, 14 Feb 2009 16:55
Date: Sat, 14 Feb 2009 16:55
11 lines
1276 bytes
1276 bytes
Probably because you're using CS3 or CS4. In these versions of InDesign, the Story.textFrames collection is the collection of text frames that are inline or anchored to the story. What you are interested in is the textContainers property (which is an array, by the way, so be careful about addressing the last member; you have to use: myStory.textContainers[myStory.textContainers.length - 1]). Actually, you can use: myStory.textContainers[0].endTextFrame; which is a clearly anachronistic name for what should now be called endTextContainer. This is less typing, but takes twice as long because it involves two calls to the object model. Dave
Re: TextFrames and Stories - what am I doing wrong?
Author: Tomasz_Bujlow
Date: Sat, 14 Feb 2009 17:45
Date: Sat, 14 Feb 2009 17:45
1 lines
645 bytes
645 bytes
Thank you very much! Working!
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads