Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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);
Copy link to clipboard
Copied
Looks like JavaScript to me.
Copy link to clipboard
Copied
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)
Copy link to clipboard
Copied
If you want to use it in python photoshop api
Why would I want to do that?
You stated »Javascript doesn't matter either« in your original post, so what did you mean by that?
Copy link to clipboard
Copied
I think it's a translator error
I mean, it's okay to do it in JavaScript
Copy link to clipboard
Copied
Thanks; yeah, Auto-translation can be less than perfect.