So I'm quite new to JS, I'm more of a Python scripter but in any case can some 1 have a look at my code and suggest few options how can I make it to work?
So here is my 1st basic script:
Code: Select allvar doc = app.activeDocument;
var Test = doc.artLayers.getByName("test_A");
moveLayerToSetLit(doc, Test 'Group_A');
function moveLayerToSetLit(doc, srcLayer, toLayerName) {
var destLayer = doc.layers[toLayerName];
srcLayer.move(destLayer, ElementPlacement.INSIDE);
}
The problem with the script above is that if the Group_A is within a group it wont move in to it... so how can I get around that?
Second script I struggle with is a bit more confusing.
Basically I want to select and isoline layer Test_B
Then I want to select Channel R G B and duplicate each R G B channel.
Then I would like to rename that RGB copy to different names I pre setup.
So here is the script so far I got that sort of dont work:
Code: Select allvar doc = app.activeDocument;
var TestB = doc.artLayers.getByName("test_B");
doc.activeChannels=[doc.channels.duplicate('Blue',doc)]; // this select channel but dont duplicate it)
Now I have no idea - yet how to isoline layer but I'll get there aventually. However I dont know why would he not duplicate channel...
No idea how to rename stuff yet so yay...
And the last script I want to use is to select channel by name and then apply it as a mask to folder/layer... I got a code to apply the mask, I got the code to pick channel but I dont know how to select...
Code: Select allvar doc = app.activeDocument;
doc.activeChannels = [doc.channels.getByName('Blue')];
//Missing part
makeLayerMask('HdSl');
function makeLayerMask(maskType) {
if( maskType == undefined) maskType = 'RvlS' ; //from selection
//requires a selection 'RvlS' complete mask 'RvlA' otherThanSelection 'HdSl'
var desc140 = new ActionDescriptor();
desc140.putClass( charIDToTypeID('Nw '), charIDToTypeID('Chnl') );
var ref51 = new ActionReference();
ref51.putEnumerated( charIDToTypeID('Chnl'), charIDToTypeID('Chnl'), charIDToTypeID('Msk ') );
desc140.putReference( charIDToTypeID('At '), ref51 );
desc140.putEnumerated( charIDToTypeID('Usng'), charIDToTypeID('UsrM'), charIDToTypeID(maskType) );
executeAction( charIDToTypeID('Mk '), desc140, DialogModes.NO );
}
Any help would be awesome... thanks!
Thanks, bye.