Quantcast
Channel: Adobe Community: Message List - Photoshop Scripting
Viewing all articles
Browse latest Browse all 27456

Re: How to get event target?

$
0
0

All the event descriptor has is the name of the layer hidden.

 

If your layers have unique names and are on the top level you can use document.layers.getByName();

 

If the names are unique and could be in layerSets you can either search all the layer in all the layerSets using the Photoshop Object Model or use Action Manager.

 

function selectLayerByName(layerName) {    var desc1 = new ActionDescriptor();    var ref1 = new ActionReference();    ref1.putName(app.charIDToTypeID('Lyr '), layerName);    desc1.putReference(app.charIDToTypeID('null'), ref1);    desc1.putBoolean(app.charIDToTypeID('MkVs'), false);    executeAction(app.charIDToTypeID('slct'), desc1, DialogModes.NO);
};

 

Then the activeLayer would be the one just hidden. Other than making the layer active, I don't know a good way to get an artLayer object from Action Manager.

 

I don't know how you could tell which layer was hidden if you have more than one layer with the same name.


Viewing all articles
Browse latest Browse all 27456

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>