It may help to look at the Photoshop JavaScript Ref.pdf that is installed with Photoshop. This list the methods and properties in the Object Model. For example you would have seen that this line
doc.activeLayer.Interior
may not work. Interior is not a standard Object Model property. So unless you set that property somewhere else it would be undefined. Even if you did set it to some value, using it like this doesn't do anything.
To select a layer( make it active ) you do something like this
app.activeDocument = app.activeDocument.layers.getByName('Layer 1');
Renaming, moving and few other functions...
-
Dariusz1989
Renaming, moving and few other functions...
Heya
Yes thats exactly how I had it set up.(if I memory serve me right this is the code more or less=)
I have:
Code: Select allInterior = doc.layerSets.getByName('Group 1')
Exterior = doc.layerSets.getByName('Group 2')
doc.activeLayer.Interior
doc.(selecting channel here cant remember what the line was like)
makeLayerMask('RvlS');
then I had
doc.activeLayer.Exterior
doc.(select channel)
makeLayerMask('RvlS');
The 1st line of code run fine and apply mask but then it dont select Exterior layer and crashes. Or should I put the Exterior=doc.layers.getByName('Group 2')
just before doc.activeLayer.Exterior rather than on top?
I thought that if I define names on top then I can just call back to them and execute them later but for some reason dont work this way. Maybe my understanding of Javascript is wrong and thinking that code is executed from top to bottom is wrong uhh...
I read somewhere that layers and layerSets are the same or very similar so it should work but not definitive answer so far.
THanks Mike for help
Edit:
Got it solved. It appears all I needed is this:
Code: Select alldoc.activeLayer = doc.layerSets["Group 7"];
Once I get home I'll give it a go in my script whh... Sorry for bugging!
Yes thats exactly how I had it set up.(if I memory serve me right this is the code more or less=)
I have:
Code: Select allInterior = doc.layerSets.getByName('Group 1')
Exterior = doc.layerSets.getByName('Group 2')
doc.activeLayer.Interior
doc.(selecting channel here cant remember what the line was like)
makeLayerMask('RvlS');
then I had
doc.activeLayer.Exterior
doc.(select channel)
makeLayerMask('RvlS');
The 1st line of code run fine and apply mask but then it dont select Exterior layer and crashes. Or should I put the Exterior=doc.layers.getByName('Group 2')
just before doc.activeLayer.Exterior rather than on top?
I thought that if I define names on top then I can just call back to them and execute them later but for some reason dont work this way. Maybe my understanding of Javascript is wrong and thinking that code is executed from top to bottom is wrong uhh...
I read somewhere that layers and layerSets are the same or very similar so it should work but not definitive answer so far.
THanks Mike for help
Edit:
Got it solved. It appears all I needed is this:
Code: Select alldoc.activeLayer = doc.layerSets["Group 7"];
Once I get home I'll give it a go in my script whh... Sorry for bugging!