Script to play action via top layer name
Hi everyone
I've been playing around with scripting for a little while, however I don't quite understand what all is going on.
This is the script I've come up with:
#target photoshop
var s = app.activeDocument;
if(putName = "Flash 4" ){
app.doAction('4 Layer Flash', 'New Script Actions')
}
else {
if (putName = "Flash 3" ){
app.doAction('3 Layer Flash', 'New Script Actions')
}
else {
if (putName = "Flash 2" ){
app.doAction('2 Layer Flash', 'New Script Actions')
}
else {
if (putName = "No Flash 2" ){
app.doAction('2 Layer No Flash', 'New Script Actions')
}
}
}
}
What I was hoping this would do is run an action based off the top layers name which I would change to depending on how many layers I have and what I want it to do.
The issue i'm having is that even if I specify the name of the layer e.g No Flash 2 it would still run Flash 4.
Clearly I am doing something wrong.
Could anyone help me rectify where my mistakes are and what I should change?