Article View: adobe.scripting.indesign
Article #17175Re: VB scripts
From: Olav Kvern
Date: Fri, 27 Jun 2003 17:31
Date: Fri, 27 Jun 2003 17:31
45 lines
2453 bytes
2453 bytes
Oli--
Here's something I wrote/posted a while ago--does this do what your friend wants to do?
Rem SplitSelectedStory.vbs
rem An InDesign 2.x script
Rem Splits the selected story into separate (i.e., unthreaded) text frames.
Rem To use this script, select a text frame, then run the script.
Rem Note: Any overset text at the end of the story will be deleted.
Rem Note: Hyphenation points between text frames will not be retained.
Set myInDesign = CreateObject("InDesign.Application.2.0")
Set mySelection = myInDesign.Selection
Rem Process the selection. If text or a text frame is selected,
Rem do something; otherwise, do nothing.
If mySelection.Count > 0 Then
Select Case TypeName(mySelection.Item(1))
Case "Text"
Set myStory = mySelection.Item(1).ParentTextFrame.ParentStory
mySplitStory = True
Case "TextFrame"
Set myStory = mySelection.Item(1).ParentStory
mySplitStory = True
Case Else
mySplitStory = False
End Select
If mySplitStory = True Then
Rem Duplicate each text frame in the story.
For myCounter = myStory.TextFrames.Count To 1 Step -1
Set myTextFrame = myStory.TextFrames.Item(myCounter)
myTextFrame.Duplicate
myTextFrame.Delete
Next
End If
End If
This one is a VBScript, so all you need to do is paste it into a text editor and save it with the file extension ".vbs" to your ~/InDesign/Scripts folder. At that point, you can run it from the Scripts palette.
Thanks,
Ole
Technical Details
Message-ID:
<1de9b4fc.1@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!skynet.be!skynet.be!newsgate.cistron.nl!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de9b4fc.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,2652f80ea1bf1726 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-06-27 10:37:47 PST From: "Olav Kvern" <okvern@adobe.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!skynet.be!skynet.be!newsgate.cistron.nl!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: VB scripts Message-ID: <1de9b4fc.1@WebX.la2eafNXanI> Date: Fri, 27 Jun 2003 10:31:14 -0700 References: <1de9b4fc.-1@WebX.la2eafNXanI> Lines: 46 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit