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

How to apply style on the active layerSet with Js?

Explorer ,
Mar 02, 2017 Mar 02, 2017

Copy link to clipboard

Copied

Hi, I am new in Js and so far I am capable of applying styles on artLayers with Js.

This is my code for that

app.activeDocument.artLayers["artLayer Name"].applyStyle("Name of the Style");

But I don't know how to apply a style on the active layerSet. It will be really helpful to apply a style on a folder because  that way I will apply the same effect in all the layerSet's contents.

Can you help me?

TOPICS
Actions and scripting

Views

1.3K

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 , Mar 02, 2017 Mar 02, 2017

Hi evangelos.vlasopoulos,

layer sets does not have the method applyStyle().

But you can do the same with ActionManager code (it's JavaScript compatible)

var yourStyle = "Pyramide"; // your own style name

var laySet = "Gruppe 1"; // your own layer set name

(ref1 = new ActionReference()).putName(stringIDToTypeID('style'), yourStyle);

(desc = new ActionDescriptor()).putReference(stringIDToTypeID('null'), ref1);

(ref2 = new ActionReference()).putName(stringIDToTypeID('layer'), laySet)

desc.putReference(stri

...

Votes

Translate

Translate
Adobe
Community Expert ,
Mar 02, 2017 Mar 02, 2017

Copy link to clipboard

Copied

Hi evangelos.vlasopoulos,

layer sets does not have the method applyStyle().

But you can do the same with ActionManager code (it's JavaScript compatible)

var yourStyle = "Pyramide"; // your own style name

var laySet = "Gruppe 1"; // your own layer set name

(ref1 = new ActionReference()).putName(stringIDToTypeID('style'), yourStyle);

(desc = new ActionDescriptor()).putReference(stringIDToTypeID('null'), ref1);

(ref2 = new ActionReference()).putName(stringIDToTypeID('layer'), laySet)

desc.putReference(stringIDToTypeID('to'), ref2)

desc.putBoolean(stringIDToTypeID('group'), true)

executeAction(stringIDToTypeID('applyStyle'), desc, DialogModes.NO);

The previous code will apply the (existing!) style with name "Pyramide" to the layer set with name "Gruppe 1"

Have fun

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
Explorer ,
Mar 02, 2017 Mar 02, 2017

Copy link to clipboard

Copied

LATEST

Thank you very much my friend! That did the trick!

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