This file contains 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 selection = context.selection; | |
for (var i = 0; i < selection.count(); i++) { | |
var layer = selection[i]; | |
if ([layer class] === MSSymbolInstance) { | |
layer.setName([layer symbolMaster].name()); | |
} | |
} |
This file contains 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) { |
This file contains 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 | |
var page = doc.currentPage() | |
var pages = doc.pages() | |
var count = 0; | |
var navbarSymbol = findSymbolByName("Material/Bar/Nav"); | |
for (i = 0; i < pages.count(); i++) { | |
var artboards = pages[i].artboards() | |
This file contains 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; |
This file contains 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 selections = context.selection, | |
loop = selections.objectEnumerator(), | |
selection; | |
while (selection = loop.nextObject()) { | |
var rectangle = MSRectangleShape.new(); | |
rectangle.frame().x = selection.frame().x(); | |
rectangle.frame().y = selection.frame().y(); | |
rectangle.frame().width = selection.frame().width(); |
This file contains 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 symbols = context.selection, | |
symbolLoop = symbols.objectEnumerator(), | |
symbol; | |
while (symbol = symbolLoop.nextObject()) { | |
var pages = context.document.pages(), | |
pagesLoop = pages.objectEnumerator(), | |
page, | |
master, | |
count = 0; |
This file contains 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 artboards = context.document.valueForKeyPath("[email protected]"), | |
loop = artboards.objectEnumerator(), | |
artboard; | |
while (artboard = loop.nextObject()) { | |
artboard.exportOptions().setLayerOptions(2); | |
} |
This file contains 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 layerName = "Native/Bar/Nav", | |
predicate = NSPredicate.predicateWithFormat("name == %@",layerName), | |
layers = context.document.currentPage().children().filteredArrayUsingPredicate(predicate); | |
for (i = 0; i < layers.length; i++) { | |
layers[i].setIsLocked(0); | |
layers[i].frame().setHeight(42); | |
layers[i].select_byExpandingSelection(true,false); | |
context.document.actionsController().actionForID("MSAlignLayersBottomAction").doPerformAction(nil); | |
layers[i].setIsLocked(1); |
This file contains 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 libraries = AppController.sharedInstance().librariesController().libraries(), | |
libraryLoop = libraries.objectEnumerator(), | |
library; | |
while (library = libraryLoop.nextObject()) { | |
// Do something | |
} |
This file contains 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
for (var obj in arr) { | |
var i = Object.keys(arr).indexOf(obj); | |
} |
OlderNewer