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

I want to create a modal button that opens the add a layer style settings window

Community Beginner ,
Jan 04, 2023 Jan 04, 2023

I want to create a modal button that opens the add a layer style settings window provided by photoshop.

67948272_0-1672859972370.png

 

TOPICS
Actions and scripting , macOS , Windows
636
Translate
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

Community Expert , Jan 04, 2023 Jan 04, 2023

@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
...
Translate
Adobe
LEGEND ,
Jan 04, 2023 Jan 04, 2023

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.

Translate
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 ,
Jan 04, 2023 Jan 04, 2023

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

Translate
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 Expert ,
Jan 04, 2023 Jan 04, 2023

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
Translate
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 ,
Jan 04, 2023 Jan 04, 2023

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.

lll1234_0-1672902316785.png

 

 

Translate
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
LEGEND ,
Jan 05, 2023 Jan 05, 2023

Like I said. Record an action, insert menu item Layer->Layer Style->Blending Options. No script listener needed. Simple, simple. Works as advertised.

Translate
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 Expert ,
Jan 04, 2023 Jan 04, 2023

@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);
Translate
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 ,
Jan 04, 2023 Jan 04, 2023

Thank you once. I will try to apply it and write the result again.

Translate
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 Expert ,
Jan 04, 2023 Jan 04, 2023

OK, let me know how the code works for you.

Translate
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
LEGEND ,
Jan 05, 2023 Jan 05, 2023

Are you going to use the UXP code you got in the other forum?

Translate
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 ,
Jan 05, 2023 Jan 05, 2023

I am trying this code now. We'll post the results after that.

Translate
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 ,
Jan 05, 2023 Jan 05, 2023

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?

Translate
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 Expert ,
Jan 05, 2023 Jan 05, 2023

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

Translate
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 ,
Jan 05, 2023 Jan 05, 2023

you are the best thank you so much
Thanks to you, I feel like my knowledge has broadened.

Translate
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 Expert ,
Jan 06, 2023 Jan 06, 2023

@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

 

https://youtu.be/x_rMhCz-MdQ

 

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:

 

https://github.com/Adobe-CEP/CEP-Resources/blob/master/Documentation/Product%20specific%20Documentat...

Translate
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
LEGEND ,
Jan 05, 2023 Jan 05, 2023
Translate
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 ,
Jan 05, 2023 Jan 05, 2023

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.

Translate
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
LEGEND ,
Jan 06, 2023 Jan 06, 2023
LATEST

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.

Translate
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