Created
April 1, 2014 20:27
-
-
Save Arahnoid/9922452 to your computer and use it in GitHub Desktop.
Make layer active by name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* makeLayerActiveByName | |
* @param string nm Layer name] | |
* @return | |
* @usage selects layer by name and mak it active | |
* @env Photoshop | |
*/ | |
function makeLayerActiveByName(nm) { | |
function cTID(s) { return app.charIDToTypeID(s); }; | |
try { | |
var desc5 = new ActionDescriptor(); | |
var ref4 = new ActionReference(); | |
ref4.putName( cTID('Lyr '), nm); | |
desc5.putReference( cTID('null'), ref4 ); | |
desc5.putBoolean( cTID('MkVs'), false ); | |
executeAction( cTID('slct'), desc5, DialogModes.NO ); | |
return true; | |
} catch (e) { | |
return false; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment