Copy link to clipboard
Copied
I cannot find a shortcut for copy/pasting in place ACROSS a spread symmetrically. For examples, like on a master page, you may want have the page numbers equidistant from the edges of the pages.
I'd like to know if someone may know how to do this OR if maybe a macro/scripting could be made.
I figure out a formula for the new X value of the object that one would be copying and pasting:
2* (Page Width) - (original X Value of object) - (Width of object)
(see below).
Any ideas on how to expedite this?
Thanks!
… But if you wanna play!…
At the beginning, just select the items you want to duplicate on the other side:
One click later! …
(^/)
Of course, it works from right to left and on the entire active spread [items on the 2 pages to be duplicated on the other one].
… For fun: this doesn't work if the spread contains only one page! [of course!]
[ It's done by script! … Personally, not for free! ]
Copy link to clipboard
Copied
Hi dsev1,
This could be possible through scripts only, hence moving this thread to InDesign Scripting
Also, please refer to the similar discussion mentioned below:
Indesign Macros (when a script is a sledge hammer)
Regards
Srishti
Copy link to clipboard
Copied
… But if you wanna play!…
At the beginning, just select the items you want to duplicate on the other side:
One click later! …
(^/)
Of course, it works from right to left and on the entire active spread [items on the 2 pages to be duplicated on the other one].
… For fun: this doesn't work if the spread contains only one page! [of course!]
[ It's done by script! … Personally, not for free! ]
Copy link to clipboard
Copied
Wow, excellent!
Are you will to post the script?
Thanks!!
Copy link to clipboard
Copied
If you intend to use this for page numbers on the outside, as per your example, then the simplest way is to create a text box as wide as the text frame. Alt+Shift+drag it to the other spread; either use manual guidelines or Smart Guides to position it into the same place. Set the text justification to "Away from spine", and you can use the same paragraph style for both without overrides.
(And of course it can be scripted(*) as well. You might not even need the calculation; page coordinates can be temporarily set to "Page", rather than "Spread", so all positions only need negating -- or so I believe, off the top of my head & rather late at nite.)
(*) InDesign does not have "macros" or otherwise recordable "actions".
Copy link to clipboard
Copied
Hi dsev1,
It seems an ideal case for using the Spread coordinate space. (The below snippet should work whatever the ruler units, origin, or spread view orientation.)
function mirrorSelection( a,t)
// -------------------------------------
// Duplicate the selected objects across the spread symmetrically.
// (This snippet only performs TRANSLATIONS. Rotation and/or shear
// attributes are not mirrored.)
{
if( !(a=app.properties.selection) || (!a.length) || !('transform' in a[0] ) )
{
alert( "Please select at least a page item." );
return;
}
const CS_SPREAD = +CoordinateSpaces.spreadCoordinates,
AP_CENTER = +AnchorPoint.centerAnchor,
MX = [1,0,0,1,0,0];
while( t=a.pop() )
{
MX[4] = -2*t.resolve(AP_CENTER, CS_SPREAD)[0][0];
t.duplicate().transform(CS_SPREAD, AP_CENTER, MX);
}
};
app.doScript(
mirrorSelection, ScriptLanguage.JAVASCRIPT, undefined,
UndoModes.ENTIRE_SCRIPT, "Mirror Selection"
);
@+
Marc
Copy link to clipboard
Copied
Awfully clever!
P.
Copy link to clipboard
Copied
Agreed…
Copy link to clipboard
Copied
Thanks buddies for your feedback,
Now there is a funny thing: we can perform a full reflection instead—including rotation/shear attributes— and this would require a single SCALING step relative to the center of the spread. No per-item calculation required in that case 🙂 In other words, this could be applied to a plural specifier as well—stuff like ...pageItems.everyItem()—with a significant performance gain.
The code is even simpler:
function fullMirrorSelection( a,t)
// -------------------------------------
// Duplicate the selected objects across the spread symmetrically.
// (This snippet performs a *full* reflection.)
{
if( !(a=app.properties.selection) || (!a.length) || !('transform' in a[0] ) )
{
alert( "Please select at least a page item." );
return;
}
const CS_SPREAD = +CoordinateSpaces.spreadCoordinates,
SPD_CENTER = [[0,0],CS_SPREAD],
MX = [-1,0,0,1,0,0]; // note the -1 for scaleX
while( t=a.pop() )
t.duplicate().transform(CS_SPREAD, SPD_CENTER, MX);
};
app.doScript(
fullMirrorSelection, ScriptLanguage.JAVASCRIPT, undefined,
UndoModes.ENTIRE_SCRIPT, "Full Mirror Selection"
);
Note that the transform() arguments are determined once and do not depend on the particular page item under consideration.
Results look like:
Here again the particular user settings (units, rulers, spread rotation…) do not impact the process.
Best,
Marc
Copy link to clipboard
Copied
As we say in French, "N'en jetez plus"
Copy link to clipboard
Copied
It does have a problem: the text frames get mirrored as well. It's because of that annotated "-1" in the matrix.
When using this in a design, an image may or may not be reflected – it mainly depends on its use. An ornate border, for example, can safely be reflected, but if you have a portrait of someone or the image contains text, you can't reflect them. Expecting that much real world knowledge and image recognition is a bit too much from JavaScript.
The mirroring text frames can be worked around by explicitly looping over the duplicated items and reverse-mirroring them in-place (around their own center), but then you might as well use the first script Marc's suggested.
Copy link to clipboard
Copied
Proud to get my ACP & MVP colleagues so verbose
Best,
M
Copy link to clipboard
Copied
Your concern is valid but sometimes a mirrored image is ok, sometimes not. Of course, you could introduce a dialog to let the user choose. But even then you an have mixed scenarii. So eventually, the time saved by getting all mirriored items may balance the one you will spend by manually fixing those peculiarities.
food for thought.
Copy link to clipboard
Copied
Hi Loic,
Not really sure! …
"To flip or not to flip! That is the (true) question!" [not written by me but by a very old Scripter named Shakespeare!]
The op could decide what item behavior he would like to have, then run the script for "mirroring" all the selected items!
(^/)