Copy link to clipboard
Copied
I want to create a modal button that opens the add a layer style settings window provided by photoshop.
@lll1234 – As @Lumigraphics wrote, there are already multiple options with actions and keyboard shortcuts... However, if you do want to put this into a script, one possible code chunk would be:
function s2t(s) {
return app.stringIDToTypeID(s);
}
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
var reference = new ActionReference();
reference.putProperty( s2t( "property" ), s2t( "blendOptions" ));
reference.putEnumerated( s2t( "layer" ), s2t( "ordinal" ), s
...
Copy link to clipboard
Copied
Are you talking about adding a panel with a button on it? Layer Styles are in the Layer menu and you can already customize the keyboard shortcuts for it. You can also record an action and use Insert Menu Item so you simply click the action to open that window.
Copy link to clipboard
Copied
I tried to find the log record using adobe listener and ran it, but that log code didn't work.
What I want is to fully bring up the add a layer style settings window.
I don't want to apply add a layer style settings in code.
I want to open the window as it is
Copy link to clipboard
Copied
So the SL plug-in works for you? What Ps version are you on?
The default code recorded for the blendOptions needs to be changed from:
DialogModes.NO
to:
DialogModes.ALL
Copy link to clipboard
Copied
Ps version is cc 2022,
It was the first time I knew I had to do that.
Thank you for giving us good information.
But it didn't work like the image below, so I had to resort.
Copy link to clipboard
Copied
Like I said. Record an action, insert menu item Layer->Layer Style->Blending Options. No script listener needed. Simple, simple. Works as advertised.
Copy link to clipboard
Copied
@lll1234 – As @Lumigraphics wrote, there are already multiple options with actions and keyboard shortcuts... However, if you do want to put this into a script, one possible code chunk would be:
function s2t(s) {
return app.stringIDToTypeID(s);
}
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
var reference = new ActionReference();
reference.putProperty( s2t( "property" ), s2t( "blendOptions" ));
reference.putEnumerated( s2t( "layer" ), s2t( "ordinal" ), s2t( "targetEnum" ));
descriptor.putReference( s2t( "null" ), reference );
descriptor2.putClass( s2t( "blendOptions" ), s2t( "blendOptions" ));
descriptor.putObject( s2t( "to" ), s2t( "blendOptions" ), descriptor2 );
executeAction(s2t( "set" ), descriptor, DialogModes.ALL);
Copy link to clipboard
Copied
Thank you once. I will try to apply it and write the result again.
Copy link to clipboard
Copied
OK, let me know how the code works for you.
Copy link to clipboard
Copied
Are you going to use the UXP code you got in the other forum?
Copy link to clipboard
Copied
I am trying this code now. We'll post the results after that.
Copy link to clipboard
Copied
thank you! Your code works fine!
I have one more question. I wonder if other options such as 'color overlay' and 'outer glow' windows can be opened using the attached code. Or, could you recommend some literature or resources that I can refer to?
Copy link to clipboard
Copied
Trial and error with the previous code gave me this:
function s2t(s) {
return app.stringIDToTypeID(s);
}
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
var reference = new ActionReference();
reference.putProperty( s2t( "property" ), s2t( "blendOptions" ));
reference.putEnumerated( s2t( "layer" ), s2t( "ordinal" ), s2t( "targetEnum" ));
descriptor.putReference( s2t( "null" ), reference );
descriptor2.putClass( s2t( "outerGlow" ), s2t( "outerGlow" ));
descriptor.putObject( s2t( "to" ), s2t( "outerGlow" ), descriptor2 );
executeAction(s2t( "set" ), descriptor, DialogModes.ALL);
It should be noted that this sets the outer glow properties as well as making the interface active (one and the same).
Copy link to clipboard
Copied
you are the best thank you so much
Thanks to you, I feel like my knowledge has broadened.
Copy link to clipboard
Copied
@lll1234 – You asked about resources...
The code posted was modified from the raw output of the ScriptingListener plug-in:
https://helpx.adobe.com/au/photoshop/kb/downloadable-plugins-and-content.html
This records a special low-level type of Photoshop JS (ExtendScript) code known as Action Manager, which is briefly mentioned in the Photoshop Scripting Guide PDF:
Copy link to clipboard
Copied
Copy link to clipboard
Copied
you're right. I wanted to know more.
How the code that works in jsx differs from the code that works in uxp
Thanks for posting the link, I hope it helps those who have similar questions to me.
Both were necessary depending on the situation, thank you for your interest and help.
Copy link to clipboard
Copied
Photoshop has multiple APIs for external control. UXP is the newest, Extendscript and CEP are older. You can also write plug-ins in C/C++ although that would be overkill for a simple button.