Created
August 31, 2017 15:54
-
-
Save sonburn/947a9d0bcb0313c214d61dc9bc0454a1 to your computer and use it in GitHub Desktop.
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 predicate = NSPredicate.predicateWithFormat("className == 'MSSymbolMaster'"), | |
masters = context.document.currentPage().children().filteredArrayUsingPredicate(predicate), | |
mastersLoop = masters.objectEnumerator(), | |
master; | |
while (master = mastersLoop.nextObject()) { | |
var pages = context.document.pages(), | |
pagesLoop = pages.objectEnumerator(), | |
page, | |
count = 0; | |
while (page = pagesLoop.nextObject()) { | |
var predicate = NSPredicate.predicateWithFormat("className == 'MSSymbolInstance' && symbolMaster == %@",master), | |
instances = page.children().filteredArrayUsingPredicate(predicate); | |
if (instances) count = count + instances.count(); | |
} | |
log(master.name() + " has " + count + " instances."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment