Renaming, moving and few other functions...

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

Mike Hale

Renaming, moving and few other functions...

Post by Mike Hale »

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');

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Dariusz1989

Renaming, moving and few other functions...

Post by Dariusz1989 »

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!