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"
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 !
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
...
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);
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 ?
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);
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);
Copy link to clipboard
Copied
Once again... thanks ! 🙂
Copy link to clipboard
Copied
Thanks mate. Works like a charm.