Copy link to clipboard
Copied
Would like to call the Transform:Scale command AND activate the "Maintain aspect ratio" option from the options bar.
Any idea? thx.
This shoud call the transform command with the aspect ratio linked. And you should be able to use it in a Configurator button.
...function transformDialog() {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
desc.putReference( charIDToTypeID('null'), ref );
desc.putEnumerated( charIDToTypeID('FTcs'), charIDToTypeID('QCSt'), charIDToTypeID('Qcsa') );
var desc1
Copy link to clipboard
Copied
You don't need this by using a script.
Layer.resize (horizontal: number , vertical: number , anchor: AnchorPosition )
Data Type: number , Default Value: 100
The amount to scale the object (as a percentage).
All you have to do is work with the same value of „number“.
Copy link to clipboard
Copied
Thanks for your reply.
I should have pointed out that the actual editing will be done manually though. The goal is to create a workaround for a 'tool preset'. The command is then integrated as a customized button via Adobe Configurator...
So, any idea how to access the options bar from JS?
Copy link to clipboard
Copied
This shoud call the transform command with the aspect ratio linked. And you should be able to use it in a Configurator button.
function transformDialog() {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
desc.putReference( charIDToTypeID('null'), ref );
desc.putEnumerated( charIDToTypeID('FTcs'), charIDToTypeID('QCSt'), charIDToTypeID('Qcsa') );
var desc1 = new ActionDescriptor();
desc1.putUnitDouble( charIDToTypeID('Hrzn'), charIDToTypeID('#Pxl'), 0.000000 );
desc1.putUnitDouble( charIDToTypeID('Vrtc'), charIDToTypeID('#Pxl'), 0.000000 );
desc.putObject( charIDToTypeID('Ofst'), charIDToTypeID('Ofst'), desc1 );
desc.putUnitDouble( charIDToTypeID('Wdth'), charIDToTypeID('#Prc'), 100.000000 );
desc.putUnitDouble( charIDToTypeID('Hght'), charIDToTypeID('#Prc'), 100.000000 );
desc.putBoolean( charIDToTypeID('Lnkd'), true );
desc.putEnumerated( charIDToTypeID('Intr'), charIDToTypeID('Intp'), charIDToTypeID('Bcbc') );
try{
executeAction( charIDToTypeID('Trnf'), desc, DialogModes.ALL );
}catch(e){}
};
transformDialog();
Copy link to clipboard
Copied
Thanks, Michael!
Works great - highly appreaciate your help!
Might be worth a feature request to make this option a standard tool preset...
10,578 views within the last 12 month on the same topic here:
Copy link to clipboard
Copied
Hi All, I'm an amateur at scripting in Photoshop so please forgive my ignorance. Where does this piece of script go?
Copy link to clipboard
Copied
just save the file as "MyScript.jsx" and then run it. Save it wherever you want.