Choose Crop Preset in PS via AppleScript or JavaScript

75 views Asked by At

I would really appreciate some help with this issue.

There is a larger AppleScript which opens the pictures inside of a folder and applies different Photoshop steps on them.

The Script crops the pictures multiple times in it's life cycle by using a selection and executing the PS Crop tool via System Events (key codes). The last crop has to be with specific dimensions which i saved as a Crop preset with specific name. enter image description here

The problem is that i can't find a way to tell AppleScript to use that preset. I've tried all kinds of cropping methods by setting the desired dimensions (crop bounds, image events and more) but all of those methods delete the pixels after cropping and i need them not to be deleted, as PS crop tool allows. Also PS crop tool changes the aspect ratio of the resulted pictures according to the new dimensions and not distorting the image during the process (not sure if i explained this right). So i have to think of a way to switch to that crop preset somehow.

A solution with Java Script also will be useful. Even that i dont know how to program in JavaScript i can tell AppleScript to run a JavaScript file in certain point. The Java Script has to work on already opened picture, the name of the preset have to be hard-coded (no need to ask the user), and ofc to execute the cropping. I've done something kinda similar before with Indesign but no luck with PS so far.

tell application "Adobe InDesign 2021"
set my_pdf_export to get the name of every PDF export preset
set my_pdf_choice to (choose from list my_pdf_export) as string
tell active document
export format PDF type to PathToDocuments & (characters 1 thru -6 of doc_name) & ".pdf" using my_pdf_choice
end tell

Thank you in advance for the time spend helping with my issue !

0

There are 0 answers