• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Script combining menu command with options bar option?

Community Beginner ,
Oct 23, 2013 Oct 23, 2013

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.

TOPICS
Actions and scripting

Views

2.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , Oct 23, 2013 Oct 23, 2013

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

...

Votes

Translate

Translate
Adobe
Community Expert ,
Oct 23, 2013 Oct 23, 2013

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“.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 23, 2013 Oct 23, 2013

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Oct 23, 2013 Oct 23, 2013

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();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 23, 2013 Oct 23, 2013

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:

http://forums.adobe.com/message/4751220

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 07, 2014 Oct 07, 2014

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 07, 2014 Oct 07, 2014

Copy link to clipboard

Copied

LATEST

just save the file as "MyScript.jsx" and then run it. Save it wherever you want.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines