Article View: adobe.scripting.indesign
Article #19460Re: adding a text frame inside a text frame
From: Olav Kvern
Date: Mon, 09 Dec 2002 21:11
Date: Mon, 09 Dec 2002 21:11
53 lines
2620 bytes
2620 bytes
Matt--
Here's an example script:
tell application "InDesign 2.0.1"
--Create an example document.
set myDocument to make document
tell myDocument
set myPage to page 1
set myBounds to my myGetPageBounds(myPage, myDocument)
set myString to "1a" & tab & "2a" & tab & "3a" & tab & "4a" & return
set myString to myString & "1b" & tab & "2b" & tab & "3b" & tab & "4b" & return
set myTextFrame to make text frame with properties {geometric bounds:myBounds, contents:myString}
tell characters 1 through -2 of paragraph 1 of myTextFrame
set myTable to make table
end tell
tell characters 1 through -2 of paragraph 2 of myTextFrame
set myTable to make table
end tell
--Add a page and create a new text frame.
set myPage to make page
tell myPage
set myNewTextFrame to make text frame with properties {geometric bounds:myBounds, contents:placeholder text}
end tell
--Move the paragraph containing the first table from the text frame on page 1 into the frame on page 2
move paragraph 1 of text frame 1 of page 1 to insertion point 1 of paragraph 1 of text frame 1 of page 2
end tell
end tell
on myGetPageBounds(myPage, myDocument)
tell application "InDesign 2.0.1"
set myMarginPreferences to margin preferences of myPage
set myDocumentPreferences to document preferences of myDocument
tell myPage
set myX1 to margin left of myMarginPreferences
set myY1 to margin top of myMarginPreferences
set myX2 to (page width of myDocumentPreferences) - (margin right of myMarginPreferences)
set myY2 to (page height of myDocumentPreferences) - (margin bottom of myMarginPreferences)
end tell
end tell
return {myY1, myX1, myY2, myX2}
end myGetPageBounds
Hope that helps!
Thanks,
Ole
Technical Details
Message-ID:
<1de6e43b.8@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de6e43b.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,1b85a7ac7e50be86 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2002-12-09 13:37:46 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-01!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: adding a text frame inside a text frame Message-ID: <1de6e43b.8@WebX.la2eafNXanI> Date: Mon, 9 Dec 2002 13:11:07 -0800 References: <1de6e43b.-1@WebX.la2eafNXanI> Lines: 56 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit