Thursday, September 01, 2005
More on This Morning's Script
One of the first things I realized about the script I presented this morning is that it is not really necessary in that if the script didn't exist and I just used the menu item (via the shortcut), all I'd have to do is press the Command key and I'd be able to drag the text frame where I needed it.
But there's nothing like having the selection change to the frame to remind me of this. So I think I'm still going to use it even though I've just discovered a bug: the selection could be overset. So, my four lines of code are going to have to expand to address this issue. Actually, it still takes only four lines, but I go about selecting the text frame differently:
For safety, I should only use this approach if I have first detected that the insertion point is overset. And, come to think of it, why doesn't fit frame to content work for a threaded frame. Let's fix that too.
Sounds like a script for another day. There are ramifications I need to think through, for example, how to determine if some text is overset?
But there's nothing like having the selection change to the frame to remind me of this. So I think I'm still going to use it even though I've just discovered a bug: the selection could be overset. So, my four lines of code are going to have to expand to address this issue. Actually, it still takes only four lines, but I go about selecting the text frame differently:
if (app.selection[0].isPureText()) {This approach has the advantage of also working in CS. However, there are some possible ramifications if you were to try to use this script to fit frame to content for a frame in the middle of a long story; you'd suddenly find yourself on a completely different page and the fit command wouldn't work.
app.select(app.selection[0].parentStory.textFrames[-1]);
}
app.selection[0].fit(FitOptions.frameToContent);
For safety, I should only use this approach if I have first detected that the insertion point is overset. And, come to think of it, why doesn't fit frame to content work for a threaded frame. Let's fix that too.
Sounds like a script for another day. There are ramifications I need to think through, for example, how to determine if some text is overset?