🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #9455

Re: JavaScript: Copy and Paste Objects from one page to another

#9455
From: Martin Fischer*
Date: Mon, 21 Aug 2006 06:30
27 lines
1662 bytes
Hi Bank,

there are two ways to do this:
1. Get all of the properties of every page item of the active page and make page items at the target page with the same constructor type as the items of the active page and assign some of the old (writable) properties to them. But you have to add the moving coordinates to the geometric bounds of every item.

2. Another way is to select everything of the active page (spread), to copy it to the clipoard, make the target page (spread) to the active page(spread), paste (in place) the contents of the clipboard and move to or by a pair of values.
e.g.:

 
var myActiveSpread = app.layoutWindows[0].activeSpread; 
var myTargetSpread = app.documents[0].spreads[0]; 
var myTargetPoint = [0,0];

app.select(NothingEnum.nothing);   
myActiveSpread.pageItems.everyItem().select();  
if (app.selection.length > 0)  
{  
	app.copy();  
	app.layoutWindows[0].activeSpread = myTargetSpread;  
	app.pasteInPlace();  
	app.selection[0].move(myTargetPoint) 
}  




Martin
Technical Details
Message-ID: <3bc15485.0@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!news.ecp.fr!news.stben.net!webcrossing
References: <3bc15485.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,94df7927ec277d84
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Martin Fischer*" <martin.fischer@online.de>
Newsgroups: adobe.scripting.indesign
Subject: Re: JavaScript: Copy and Paste Objects from one page to another
Message-ID: <3bc15485.0@webcrossing.la2eafNXanI>
Date: Sun, 20 Aug 2006 23:30:20 -0700
References: <3bc15485.-1@webcrossing.la2eafNXanI>
Lines: 31
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!news2.volia.net!news.ecp.fr!news.stben.net!webcrossing