Skip to content

Instantly share code, notes, and snippets.

@getflourish
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save getflourish/7bde0f365601e552163a to your computer and use it in GitHub Desktop.

Select an option

Save getflourish/7bde0f365601e552163a to your computer and use it in GitHub Desktop.
var doc = context.document;
var layer = context.selection[0]
var style = layer.style().textStyle()
var scope = context.document.currentPage().children();
selectLayersByTextStyle(style, scope)
function selectLayersByTextStyle(textStyle, scope) {
var predicate = NSPredicate.predicateWithFormat("(style.textStyle != NULL) && (style.textStyle isEqualForSync:%@)", textStyle);
// query page layers
var queryResult = scope.filteredArrayUsingPredicate(predicate);
// select all results
doc.currentPage().selectLayers(queryResult);
return queryResult;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment