Copy link to clipboard
Copied
Hello All
as i'm pretty new to scripting for PS and i haven't found an answer to this. Is there a good resource page (i haven't found) or a tutorial about it?
I have the following code and it would be awesome to combine it into one function and get rid of unnecessary code:
function Selecttexures() {
// Select
function step1(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putName(cTID('Lyr '), "LIGHT FABRIC TEXTURE");
desc1.putReference(cTID('null'), ref1);
desc1.putBoolean(cTID('MkVs'), false);
var list1 = new ActionList();
list1.putInteger(43);
desc1.putList(cTID('LyrI'), list1);
executeAction(cTID('slct'), desc1, dialogMode);
};
// Select Linked Layers
function step2(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
desc1.putReference(cTID('null'), ref1);
executeAction(sTID('selectLinkedLayers'), desc1, dialogMode);
};
// Hide
function step3(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var list1 = new ActionList();
var ref1 = new ActionReference();
ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));
list1.putReference(ref1);
desc1.putList(cTID('null'), list1);
executeAction(cTID('Hd '), desc1, dialogMode);
};
step1(); // Select
step2(); // Select Linked Layers
step3(); // Hide
};
Copy link to clipboard
Copied
If you still have the orginal SL code, you can use xtools\apps\ActionFileFromSLCode.jsx.
Copy link to clipboard
Copied
Thank you xbytor
I will check this script out (did so with some of your other scripts, thanks for that -> very useful).