Skip to content

Instantly share code, notes, and snippets.

var doc = context.document
var selectLayersOfType_inContainer = function(layerType, containerLayer) {
// Filter layers using NSPredicate
var scope = (typeof containerLayer !== 'undefined') ? [containerLayer children] : [[doc currentPage] children],
predicate = NSPredicate.predicateWithFormat("(className == %@)", layerType),
layers = [scope filteredArrayUsingPredicate:predicate];
// Deselect current selection