🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #18943

VB: RemoveFrameFromStory

#18943
From: Olav Kvern
Date: Wed, 05 Feb 2003 19:24
37 lines
2282 bytes
Gang--

Several people (on various mailing lists) have asked for a script that makes InDesign work like PageMaker does when you cut/paste a text frame. In InDesign, when you delete a text frame, the text flows into other frames in the story; in PageMaker, the text is deleted with the frame.

Here's a simple VBScript that removes the selected frame or frames from the story.



Rem RemoveFrameFromStory.vbs 
Rem This InDesign 2.x script removes the selected text frame 
Rem and the text it contains from its parent story. The frame 
Rem and its content will appear in the same position as it 
Rem originally occupied--it just won't be threaded to the story 
Rem anymore. This is similar to deleting and then power pasting 
Rem a text block in PageMaker. You can select multiple text frames. 
Set myInDesign = CreateObject("InDesign.Application.2.0") 
Set mySelection = myInDesign.Selection 
If mySelection.Count > 0 Then 
    For myCounter = mySelection.Count To 1 Step -1 
        If TypeName(mySelection.Item(myCounter)) = "TextFrame" Then 
            Set myTextFrame = mySelection.Item(myCounter) 
            myTextFrame.Duplicate 
            Set myFirstCharacter = myTextFrame.Characters.Item(1) 
            Set myLastCharacter = myTextFrame.Characters.Item(-1) 
            Set myText = myTextFrame.Characters.ItemByRange(myFirstCharacter, myLastCharacter).Item(1) 
            myText.Delete 
            myTextFrame.Delete 
        End If 
    Next 
End If 




Thanks,

Ole
Technical Details
Message-ID: <1de7b736.-1@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebX

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,78cb297ac78bd078,start
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-02-05 11:38:08 PST
From: "Olav Kvern" <okvern@adobe.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer01.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: VB: RemoveFrameFromStory
Message-ID: <1de7b736.-1@WebX.la2eafNXanI>
Date: Wed, 5 Feb 2003 11:24:35 -0800
Lines: 38
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit