Skip to content

Instantly share code, notes, and snippets.

@sonburn
Created November 4, 2016 20:12
Show Gist options
  • Save sonburn/0e8c5fda4ebcb8625986fa46903d50eb to your computer and use it in GitHub Desktop.
Save sonburn/0e8c5fda4ebcb8625986fa46903d50eb to your computer and use it in GitHub Desktop.
Select all symbol instances on current page
var doc = context.document;
// Deselect everything
doc.currentPage().deselectAllLayers();
// Recursive execute through all layers
selectSliceRecursive(doc.currentPage());
function selectSliceRecursive(layer) {
if (layer instanceof MSSymbolInstance) {
layer.select_byExpandingSelection(true, true);
return
}
try {
var children = layer.layers();
for (var i = 0; i < children.length; i++) {
selectSliceRecursive(children.objectAtIndex(i));
}
} catch(e) { }
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment