Copy link to clipboard
Copied
Hi @r28071715i111, here's an idea (and a working script). First you select each graphic (can be the graphic or it's frame) and set its Script Label (see the Script Label panel under Windows > Utilities menu) to "rotate: 15" where the 15 means 15 degrees counterclockwise. Will that work in your case? Script is below, and I've attached a demo .indd also so you can test script with that first.
- Mark
/**
* Apply rotation to graphics with a "rotate" script label.
...
Hi @r28071715i111, my idea was that you set up the script labels before datamerge and then run script after datamerge.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Is the rotation angle variable? If so then how is it determined? If not then can't you rotate the image frame beforehand and then do the merge?
-Manan
Copy link to clipboard
Copied
Thanks For your Replay Manan
rotation angle is variable depends on its graphic frame )
( If the image is in graphic frame 1 , rotate it by 30 degrees )
( If the image is in graphic frame 2 , rotate it by 20 degrees )
and so on
I want to select image angle degrees of all its graphic frames before i make data merge
Or
Its is possibe after making data merge but it is necessary to add in script ( From page number ( ) to page number ( )
or apply in all pages of the document
Copy link to clipboard
Copied
Hi @r28071715i111, here's an idea (and a working script). First you select each graphic (can be the graphic or it's frame) and set its Script Label (see the Script Label panel under Windows > Utilities menu) to "rotate: 15" where the 15 means 15 degrees counterclockwise. Will that work in your case? Script is below, and I've attached a demo .indd also so you can test script with that first.
- Mark
/**
* Apply rotation to graphics with a "rotate" script label.
* eg. if label is "rotate: 15", then the graphic will be
* rotated by 15° counter-clockwise.
* @author m1b
* @discussion https://community.adobe.com/t5/indesign-discussions/script-to-rotate-selected-image-inside-frame-data-merge/m-p/13955151
*/
function main() {
var doc = app.activeDocument,
tm = app.transformationMatrices.add({ counterclockwiseRotationAngle: 0 }),
images = doc.allGraphics,
matcher = /^rotate:(-?\d+\.?\d*)/i,
label,
value;
for (var i = 0; i < images.length; i++) {
label = images[i].label || images[i].parent.label;
if (!label)
continue;
value = label.match(matcher);
if (!value
|| value.length < 2
|| isNaN(value = Number(value[1]))
)
continue;
images[i].transform(
CoordinateSpaces.pasteboardCoordinates,
AnchorPoint.centerAnchor,
tm.rotateMatrix(-images[i].absoluteRotationAngle + value),
);
}
};
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Rotate Graphics');
Copy link to clipboard
Copied
Thanks For your Reply mark
But I have a question : Is that script work after making data merge or before ?
Ex : I want all images across pages in graphic frame 1 rotate by 10 degress
all images across pages in graphic frame 2 rotate by 23 degress
And so on
I will try your script and tell you result
Thanks for your effort in advance
Copy link to clipboard
Copied
Hi @r28071715i111, my idea was that you set up the script labels before datamerge and then run script after datamerge.
Copy link to clipboard
Copied
Very very great thanks for you
your script works like a charm
as you said i set up the script labels before datamerge then saved file and then run script after datamerge
Copy link to clipboard
Copied
I'm glad it worked for you! 🙂
Copy link to clipboard
Copied
My point is if there is no logic that comes in from the merged data and we have to go to every frame one by one anyhow even in the case of using @m1b's script then why don't we do it manually. Script could help only if we can narrow down the use case of going to each frame. Something like all graphics on page 1 rotates by 15 degrees, etc.
-Manan
Copy link to clipboard
Copied
We can't do it manually because it takes a lot of time
suppose that we have 500 pages and each page contain 5 graphic frames each of them rotate by certain angle that mean 2500 images , it will spend too much hours .
Thanks for your reply
Copy link to clipboard
Copied
If you know upfront which image should be rotated and by how much - and it looks like you know, as you can set labels to the frames - then you can rotate them in Photoshop BEFORE importing...
Copy link to clipboard
Copied
Thanks for your reply
But i can't make this soltion beacause images are distributed among 500 folders not in one folder
Copy link to clipboard
Copied
I'm pretty sure Photoshop should be able to handle subfolders?
And why so many subfolders?
By any chance you work on a PC? Then you could use the free version of my ID-Tasker.
Copy link to clipboard
Copied
Because Each folder belongs to one student and its images only and students images not renamed by its name so that i can know the But its renaming is by numbers
Sure ...I will use free version of id tasker and if i agreed it , I will purshace licence