Created
November 4, 2016 20:12
-
-
Save sonburn/0e8c5fda4ebcb8625986fa46903d50eb to your computer and use it in GitHub Desktop.
Select all symbol instances on current page
This file contains hidden or 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
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