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

Scripting : Open specific dialogs (layer styles, color picker, etc.)

Participant ,
Jun 23, 2020 Jun 23, 2020

Copy link to clipboard

Copied

Hey there,

 

Is there a good and safe way to open photoshop dialogs within a script ? For instance, I'd like to be able to open the "Layer Style" dialog... the one you get when you double-click a layer, or right-click and choose "Blending Options"

Screen Shot 2020-06-23 at 11.27.18 PM.png

 I know there's a way, using the photoshop's menus with IDs and such, but I hate this solution, since the menu order could change from a PS version to another...

 

I'd rather find some better way.

 

Anyone ?

 

Thanks !

TOPICS
Actions and scripting , SDK

Views

568

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

Advocate , Jun 24, 2020 Jun 24, 2020

This is what you are looking for

 

cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putProperty(cTID('Prpr'), sTID("blendOptions"));
    ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
    desc1.putReference(cTID('null'), ref1);
    var desc2 = new ActionDescriptor();
    desc2.putClass(sTID("blendOptions"), sTID("blendOptions"));
    des
...

Votes

Translate

Translate
Adobe
Advocate ,
Jun 24, 2020 Jun 24, 2020

Copy link to clipboard

Copied

This is what you are looking for

 

cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putProperty(cTID('Prpr'), sTID("blendOptions"));
    ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
    desc1.putReference(cTID('null'), ref1);
    var desc2 = new ActionDescriptor();
    desc2.putClass(sTID("blendOptions"), sTID("blendOptions"));
    desc1.putObject(cTID('T   '), sTID("blendOptions"), desc2);
    executeAction(sTID('set'), desc1, DialogModes.ALL);

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
Participant ,
Jul 02, 2020 Jul 02, 2020

Copy link to clipboard

Copied

Now I'm wondering about some other dialogs... like the "Mask Options" and the "Select and mask" ...

 

You've got any idea ?

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
Advocate ,
Jul 04, 2020 Jul 04, 2020

Copy link to clipboard

Copied

"Mask Options"

// OPTION MASK
var desc14 = new ActionDescriptor();
var ref3 = new ActionReference();
ref3.putEnumerated( charIDToTypeID( "Chnl" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ));
desc14.putReference( charIDToTypeID( "null" ), ref3 );
var desc15 = new ActionDescriptor();
var desc16 = new ActionDescriptor();
desc16.putUnitDouble( charIDToTypeID( "H   " ), charIDToTypeID( "#Ang" ), 183.526611 );
desc16.putDouble( charIDToTypeID( "Strt" ), 100.000000 );
desc16.putDouble( charIDToTypeID( "Brgh" ), 100.000000 );
desc15.putObject( charIDToTypeID( "Clr " ), charIDToTypeID( "HSBC" ), desc16 );
desc15.putUnitDouble( charIDToTypeID( "Opct" ), charIDToTypeID( "#Prc" ), 50.000000 );
desc14.putObject( charIDToTypeID( "T   " ), charIDToTypeID( "Chnl" ), desc15 );
executeAction( charIDToTypeID( "setd" ), desc14, DialogModes.ALL );

 

"Select and mask"

 

//Select and mask
sTID = function(s) { return app.stringIDToTypeID(s); };
executeAction(sTID('refineSelectionEdge'), undefined, DialogModes.ALL);

 

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
Advocate ,
Jul 04, 2020 Jul 04, 2020

Copy link to clipboard

Copied

"Mask Options"

 

// OPTION MASK
var desc14 = new ActionDescriptor();
var ref3 = new ActionReference();
ref3.putEnumerated( charIDToTypeID( "Chnl" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ));
desc14.putReference( charIDToTypeID( "null" ), ref3 );
var desc15 = new ActionDescriptor();
var desc16 = new ActionDescriptor();
desc16.putUnitDouble( charIDToTypeID( "H   " ), charIDToTypeID( "#Ang" ), 183.526611 );
desc16.putDouble( charIDToTypeID( "Strt" ), 100.000000 );
desc16.putDouble( charIDToTypeID( "Brgh" ), 100.000000 );
desc15.putObject( charIDToTypeID( "Clr " ), charIDToTypeID( "HSBC" ), desc16 );
desc15.putUnitDouble( charIDToTypeID( "Opct" ), charIDToTypeID( "#Prc" ), 50.000000 );
desc14.putObject( charIDToTypeID( "T   " ), charIDToTypeID( "Chnl" ), desc15 );
executeAction( charIDToTypeID( "setd" ), desc14, DialogModes.ALL );

 

"Select and mask"

//Select and mask
sTID = function(s) { return app.stringIDToTypeID(s); };
executeAction(sTID('refineSelectionEdge'), undefined, DialogModes.ALL);

 

 

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
Participant ,
Jul 06, 2020 Jul 06, 2020

Copy link to clipboard

Copied

LATEST

Once again... thanks !  🙂

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
Participant ,
Jun 26, 2020 Jun 26, 2020

Copy link to clipboard

Copied

Thanks mate.  Works like a charm.

 

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