Article View: adobe.scripting.indesign
Article #9850Re: [AS] Breaking Threads (again)
From: Olav_Kvern
Date: Wed, 19 Jul 2006 20:12
Date: Wed, 19 Jul 2006 20:12
75 lines
3265 bytes
3265 bytes
Ralf--
Here's an AppleScript version:
--DuplicateLinkedFrames.as
--An InDesign CS2 AppleScript
--
--Shows how to duplicate linked text frames.
main()
on main()
tell application "Adobe InDesign CS2"
set myDocument to my myCreateExampleDocument()
--Group text frames A and B
tell page 1 of myDocument
set myTextFrameA to text frame "TextFrameA"
get class of myTextFrameA
set myStartIndex to index of character 1 of myTextFrameA
set myTextFrameB to text frame "TextFrameB"
set myEndIndex to index of character -1 of myTextFrameB
set myGroup to make group at page 1 of myDocument with properties {group items:{myTextFrameA, myTextFrameB}}
end tell
--Duplicate the group
tell myGroup
set myNewGroup to duplicate
--Ungroup the group
ungroup
end tell
--Delete the text in text frames A and B
tell parent story of myTextFrameA
delete ( characters myStartIndex thru myEndIndex )
end tell
--Delete text frames A and B
tell myTextFrameA to delete
tell myTextFrameB to delete
--Ungroup the duplicate frames (which are still linked)
tell myNewGroup to ungroup
end tell
end main
on myCreateExampleDocument()
tell application "Adobe InDesign CS2"
set myDocument to make document
--Create an example document.
--Set the measurement units to points.
tell view preferences of myDocument
set horizontal measurement units to points
set vertical measurement units to points
set ruler origin to page origin
end tell
--Create a text frame on page 1.
tell page 1 of myDocument
set myTextFrameA to make text frame with properties {geometric bounds:{72, 72, 144, 144}, label:"TextFrameA"}
--Create another text frame on page 1.
set myTextFrameB to make text frame with properties {geometric bounds:{228, 72, 300, 144}, label:"TextFrameB"}
--Add a page.
end tell
tell myDocument to make page
--Create another text frame on page 2.
tell page 2 of myDocument
set myTextFrameC to make text frame with properties {geometric bounds:{72, 72, 144, 144}}
end tell
--Link TextFrameA to TextFrameB using the next text frame property.
set next text frame of myTextFrameA to myTextFrameB
--Link TextFrameC to TextFrameB using the previousTextFrame property.
set previous text frame of myTextFrameC to myTextFrameB
--Fill the text frames with placeholder text.
set contents of myTextFrameA to placeholder text
return myDocument
end tell
end myCreateExampleDocument
Thanks,
Ole
Technical Details
Message-ID:
<3bc0e432.9@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!news2.volia.net!news.musoftware.de!news.albasani.net!news.ecp.fr!news.stben.net!webcrossingReferences:
<3bc0e432.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,3e8ecaf92c53dd01 X-Google-Attributes: gidf939a,public X-Google-Language: ENGLISH,ASCII-7-bit From: Olav_Kvern@adobeforums.com Newsgroups: adobe.scripting.indesign Subject: Re: [AS] Breaking Threads (again) Message-ID: <3bc0e432.9@webcrossing.la2eafNXanI> Date: Wed, 19 Jul 2006 13:12:53 -0700 References: <3bc0e432.-1@webcrossing.la2eafNXanI> Lines: 77 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!news2.volia.net!news.musoftware.de!news.albasani.net!news.ecp.fr!news.stben.net!webcrossing