paste in place
Hi,
I try to copy a logo on page 2 and paste it in place on page 3.
When I presee shift+opt+cmd+V, it is pasted on page 2.
Is there any better way?
Hosun

Hi,
I try to copy a logo on page 2 and paste it in place on page 3.
When I presee shift+opt+cmd+V, it is pasted on page 2.
Is there any better way?
Hosun

Yes it works as long as you explicitly code the destination page.
If I want to choose any page, you will need put up a dialog and ask me which page I want, or listen for an active page event, which is trickier. Paste In Place decides where to paste the object based on the currently active page, which might not be on the same spread as the copied object—it’s whatever page is currently selected in the Pages panel
Also, to imitate Paste In Place with a dialog we need to use the duplicate() method—Paste in Place doesn’t remove the original. So the first script I posted with the dialog would be better the duplicate method.
OK, this WORKS 😄
//Paste In Place to destination page
//Select a page item, run script, and double-click a page in the Pages panel
#targetengine "pasteinplace";
PasteInPlace()
var el, b, s;
var or = app.activeDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;
function PasteInPlace(){
if (app.selection.length > 0) {
var doc = app.activeDocument;
s = doc.selection[0];
// b = s.geometricBounds;
// app.copy()
var el = app.addEventListener("afterAttributeChanged", getBounds);
el.name = "PIP"
// alert(app.activeDocument.layoutWindows[0].activePage);
} else {
alert("Please Make a Selection")
return
}
}
function getBounds(e) {
if (e.attributeValue.constructor.name === 'Page') {
app.menuActions.itemByID(118788).invoke();
// alert(doc.activeWindow.activePage);
// app.paste();
// app.selection[0].geometricBounds = b;
// alert(s.attributeValue.constructor.name);
s.duplicate(app.activeDocument.layoutWindows[0].activePage);
app.eventListeners.itemByName("PIP").remove();
app.activeDocument.viewPreferences.rulerOrigin = or;
}
} Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.