Skip to content

Instantly share code, notes, and snippets.

@anton-liubushkin
Last active August 29, 2015 14:23
Show Gist options
  • Save anton-liubushkin/c5d05795b2b0ed22a7a5 to your computer and use it in GitHub Desktop.
Save anton-liubushkin/c5d05795b2b0ed22a7a5 to your computer and use it in GitHub Desktop.
Return how many layers are there in document — Photoshop script
function getLayersCount() {
var ref = new ActionReference();
ref.putProperty (stringIDToTypeID ("property"), charIDToTypeID('NmbL'))
ref.putEnumerated(charIDToTypeID('Dcmn'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt'));
var count = executeActionGet(ref).getInteger(charIDToTypeID('NmbL'));
return count
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment