Skip to main content
Participant
December 11, 2023
Question

How Set Layer Style parameters like visible in Scripts

  • December 11, 2023
  • 1 reply
  • 361 views

How I set Layer Style(FX) visiblity False and True
It seems simple, but it's so difficult Plz help

 

It is implemented in a Python environment (Photoshop API)

 

Javascript doesn't matter either

This topic has been closed for replies.

1 reply

Participant
December 11, 2023

I found a solution by myself

 

function cTID(s) {
    return app.charIDToTypeID(s);
}

var desc = new ActionDescriptor();
var list = new ActionList();
var ref = new ActionReference();
ref.putClass(cTID('Lefx'));
ref.putEnumerated(cTID("Lyr "), cTID("Ordn"), cTID("Trgt"));
list.putReference(ref);
desc.putList(cTID('null'), list);
// Hide
executeAction(cTID('Hd  '), desc, DialogModes.NO);

or
// Show
executeAction(cTID('Shw '), desc, DialogModes.NO);

 

 

c.pfaffenbichler
Community Expert
Community Expert
December 11, 2023

Looks like JavaScript to me. 

Participant
December 11, 2023
If you want to use it in python photoshop api
almost the same

 

js = """
function cTID(s) {
return app.charIDToTypeID(s);
}

var desc = new ActionDescriptor();
var list = new ActionList();
var ref = new ActionReference();
ref.putClass(cTID('Lefx'));
ref.putEnumerated(cTID("Lyr "), cTID("Ordn"), cTID("Trgt"));
list.putReference(ref);
desc.putList(cTID('null'), list);
// Hide
executeAction(cTID('Hd '), desc, DialogModes.NO);
or
// Show
// executeAction(cTID('Shw '), desc, DialogModes.NO);
"""

ps.app.doJavaScript(js)