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

Copy link to clipboard

Copied

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

Views

400

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

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

Votes

Translate

Translate
Adobe
LEGEND ,
Jan 04, 2023 Jan 04, 2023

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.

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

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

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

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

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

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.

lll1234_0-1672902316785.png

 

 

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

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.

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

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

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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

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

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?

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

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

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

Copy link to clipboard

Copied

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

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

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

 

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

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

Copy link to clipboard

Copied

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

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.

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

Copy link to clipboard

Copied

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.

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