Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

split story script available

383 views
Skip to first unread message

Olav Kvern

unread,
Jun 10, 2002, 3:24:31 PM6/10/02
to
Gang--

Several people have asked for a way to split a story into its component text frames, with each frame retaining its original content (that is, unthread all of the text frames but leave the content in place). I've posted a script called "SplitSelectedStory" that does just this to Adobe Xchange--you can go to http://xchange.studio.adobe.com/axBrowseSubmit.asp?t=54 <http://xchange.studio.adobe.com/axBrowseSubmit.asp?t=54> and download the script from there.

Using the script is very simple--just select one of the text frames in the story and run the script. InDesign will then split the story into separate text frames. You need not know anything about scripting to use this script--but you can also view the script if you're interested.

Thanks,

Ole

Dave Saunders

unread,
Jun 11, 2002, 12:28:05 PM6/11/02
to
Come to think of it, there's also the issue of overset text in the last frame that ought to be checked also.

Dave

Dave Saunders

unread,
Jun 11, 2002, 12:25:36 PM6/11/02
to
Ole,

Nice. I didn't realize it was that easy.

You inspired me to write this script:

tell application "InDesign 2.0.1" try set theStory to parent story of selection on error beep return end try set theParaCount to count of paragraphs of theStory set theFrameCounts to (count of paragraphs of text frames of theStory) as list set theFramesParaCount to 0 repeat with theFrameCount in theFrameCounts set theFramesParaCount to theFramesParaCount + theFrameCount end repeat if theParaCount < theFramesParaCount then activate display dialog "Warning: at least one paragraph sits across a frame boundary in the story you've select. Are you sure you want to proceed?" -- etc end if -- etc end tell

I presume you tackled the finding of the parent story in the way you did because you lifted that code from somewhere else, but the try construct I used here is less fiddly.

However, the real point of my little script is to detect if a paragraph crosses a frame boundary because if it does then running your script might not achieve the desired effect (because of indents, drop caps, etc). My question is: is there an easier/quicker way of discovering that circumstance?

Dave

Dave Saunders

unread,
Jun 11, 2002, 1:32:28 PM6/11/02
to
Ole,

Ah, you're right. I forgot about the insertion point.

And, yes, generally, only text shows up but there was a case the other day in one of your scripts -- dang I can't remember which -- where it "Character" came up.

As for warnings, etc. Me neither for my own scripts. But it's because of those kinds of issues that adding a feature to the product is a lot more complicated than banging out a script for your own use.

Dave

Olav Kvern

unread,
Jun 11, 2002, 1:21:40 PM6/11/02
to
Dave--

You've really got three selection cases:

1. Text is selected. 2. Insertion point is selected. 3. Text frame is selected.

The insertion point object does not have a parent story property, and trying to get the parent text frame of a selected range that spans multiple text frames would generate an error, so I simply collapsed the first two cases into a single case.

The other possible text objects returned are there "just in case"--I've never seen them come up, but I have a sneaking feeling that they might, at some point.

re: overset text

Nah! My assumption was that you'd just want it blown away.<g> I'm not a big believer in putting up lots of warnings and messages--my approach is: if the context is in the range of what the script expects, then do something; else do nothing.

Thanks,

Ole

0 new messages