Skip to content

Instantly share code, notes, and snippets.

@littlebusters
Created December 18, 2015 00:17
Show Gist options
  • Save littlebusters/21fb89bd0742967d841a to your computer and use it in GitHub Desktop.
Save littlebusters/21fb89bd0742967d841a to your computer and use it in GitHub Desktop.
log('This is an example Sketch script.');
var doc = context.document;
var documentName = context.document.displayName();
log('The current document is named: ' + documentName);
var selectedLayers = context.selection;
var selectedCount = selectedLayers.count();
if (selectedCount == 0) {
log('No layers are selected.');
} else {
log('Selected layers:');
for (var i = 0; i < selectedCount; i++) {
var layer = selectedLayers[i];
log((i+1) + '. ' + layer.name());
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment