🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #17395

Re: Copying pages of table flow

#17395
From: Jay Fraser
Date: Fri, 06 Jun 2003 18:16
59 lines
2847 bytes
Hey, this works --



set theHD to (path to startup disk as string) 
set thePath to "toss.txt" 
set theFile to (theHD & thePath)

tell application "InDesign 2.0.2" 
    set myDocument to active document 
    tell myDocument 
        set mySelection to selection 
        if (count of items of mySelection) is not equal to 1 then 
            activate 
            display dialog "Please select 1 (and only 1) text frame." buttons {"Cancel"} default button 1 
        end if 
        if class of item 1 of mySelection is not text frame then 
            activate 
            display dialog "Please select text frame using" & return & "Selection Tool (Black Arrow)." buttons {"Cancel"} default button 1 
        end if 
        set myTextFrame to item 1 of selection

        set myStory to object reference of parent story of myTextFrame 
        set myFrameCount to (count of text frames in myStory) 
    end tell

    repeat with i from myFrameCount to 1 by -1 
        tell myDocument 
            set myCurrentFrame to text frame i in myStory 
            set myCurrentPage to parent of myCurrentFrame 
            set myGeoBounds to geometric bounds of myCurrentFrame 
            set myPageNumber to name of myCurrentPage 
            set myDupeFrame to duplicate myCurrentFrame 
            export parent story of myDupeFrame format tagged text to theFile 
            delete myDupeFrame 
        end tell

        set myNewDocument to make document

        tell myNewDocument 
            tell page 1 
                set myNewFrame to make text frame with properties {geometric bounds:myGeoBounds} 
                place theFile on myNewFrame 
            end tell 
        end tell

        set myNewDocName to "Table_Page" & myPageNumber & ".indd" 
        save myNewDocument to (theHD & myNewDocName) 
        close active document

    end repeat

end tell



I had to duplicate the frame, export the parent story of the new frame, then import the story to a new document. It has some issues if the original document has facing pages, but that's easily fixed.

Jay
Technical Details
Message-ID: <1de96b83.5@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de96b83.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,590814201803d300
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-06-06 11:40:02 PST
From: "Jay Fraser" <jayfraser@yahoo.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Copying pages of table flow
Message-ID: <1de96b83.5@WebX.la2eafNXanI>
Date: Fri, 6 Jun 2003 11:16:07 -0700
References: <1de96b83.-1@WebX.la2eafNXanI>
Lines: 61
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit