Copy link to clipboard
Copied
Hello!
I have a question:
can a script rotate all open images counterclockwise?
It has become a daily routine for me, and takes a long time...
I would be very grateful for your answers,
Niyetkhan
1 Correct answer
Modify 'apply to all open documents' script I shared with you in other thread, by using:
activeDocument.rotateCanvas(-90)
Explore related tutorials & articles
Copy link to clipboard
Copied
Does it have to be a Script. A simple one step action is all that is needed. Menu Image>Image Rotation>90 Counter Clockwise.
It would be easy to script that batch process. But it will take you a long time to write that script for you asked that question so you do not know how to Script Photoshop. Scripting is no an easy task like recording an action.
Copy link to clipboard
Copied
Modify 'apply to all open documents' script I shared with you in other thread, by using:
activeDocument.rotateCanvas(-90)
Copy link to clipboard
Copied
I tried it
But there is an error:
dcmnts = [].slice.call(documents);
while(dcmnts.length) shft = dcmnts.shift(),
(aD = activeDocument.rotateCanvas(-90)
Copy link to clipboard
Copied
niyetkhan wrote:
I tried it
But there is an error:
dcmnts = [].slice.call(documents);
while(dcmnts.length) shft = dcmnts.shift(),
(aD = activeDocument.rotateCanvas(-90)
That error message is telling you that there is an unmatched closing parentheses character missing on the last line:
dcmnts = [].slice.call(documents);
while(dcmnts.length) shft = dcmnts.shift(),
(aD = activeDocument.rotateCanvas(-90));
However, even then I don't think that is correct, I believe that it should be:
dcmnts = [].slice.call(documents);
while (dcmnts.length) shft = dcmnts.shift(),
(aD = app.activeDocument = shft).rotateCanvas(-90);
Copy link to clipboard
Copied
for the sake of completeness:
dcmnts = [].slice.call(documents); while(dcmnts.length)
(activeDocument = dcmnts.shift()).rotateCanvas(-90)
Copy link to clipboard
Copied
Thank you very much!!!
Copy link to clipboard
Copied
Kukurykus wrote:
Modify 'apply to all open documents' script I shared with you in other thread, by using:
activeDocument.rotateCanvas(-90)
Just for future reference in case anybody is looking for said script:
dcmnts = [].slice.call(documents);
while (dcmnts.length) shft = dcmnts.shift(),
(aD = app.activeDocument = shft).activeLayer.desaturate();
Copy link to clipboard
Copied
I think what the op wanted would be mote like this:
if (documents.length){for (var i=0;i<documents.length;i++){documents[i].rotateCanvas(-90);}}
Copy link to clipboard
Copied
You missed the backstory, but it doesn't really matter.
Copy link to clipboard
Copied
I know it does not matter but it is what the op asked about.
Copy link to clipboard
Copied
I meant that the back-story didn't matter as I thought that I had documented it to help those in the future reading this topic thread.
1) niyetkhan asks the original question
2) Kukurykus replied that it is the same as the other question from niyetkhan and provided the replacement code, but didn't explicity state where to change the code or provide the link for previous code
3) niyetkhan marked this as the correct answer
4) I then supplied the link to the previous topic and provided the code from the previous topic so that this topic would be more helpful for future visitors
I guess the only thing left to do is change the previous code with the new addition, which required a minor edit to work:
dcmnts = [].slice.call(documents);
while (dcmnts.length) shft = dcmnts.shift(),
(aD = app.activeDocument = shft).rotateCanvas(-90);
Copy link to clipboard
Copied
He only didn't know exact command, not the method to do it for all documents.
Copy link to clipboard
Copied
Is that youer interpretation of
I have a question:
can a script rotate all open images counterclockwise?
one is all not in book however, I always failed English
Copy link to clipboard
Copied
Stephen_A_Marsh 'tried' to explain it but you don't understand. Read text of my first answer.
Copy link to clipboard
Copied
Modify 'apply to all open documents' script I shared with you in other thread, by using:
Without the link it hard to to tell what else the share script would do. Its a one liner in the first place
if (documents.length)for(var i=0;i<documents.length;i++)documents[i].rotateCanvas(-90)
Copy link to clipboard
Copied
Be smart and click his username profile to open previous thread created by him.
btw why you're again post a code you once posted?
Copy link to clipboard
Copied
It would surely be easier to do it in Bridge.
Copy link to clipboard
Copied
I agree... As long as all the software in the viewing and editing chain respects the orientation metadata.
Edit: forgot to mention that if rotated in Bridge and then re-saved in say Photoshop, the new rotation will be "baked in" and no longer reliant on metadata for rotation.

