Last active
September 12, 2016 14:18
-
-
Save marianomike/8b91f49e2fed2c99ea22f87c3ab3d5a3 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 onRun = function(context) { | |
//reference the Application | |
var app = [NSApplication sharedApplication]; | |
//reference the Sketch Document | |
var doc = context.document; | |
//reference all the pages in the document in an array | |
var pages = [doc pages]; | |
[app displayDialog:"This document has " + pages.count() + " pages." withTitle:"Alert Box Title"]; | |
//loop through the pages of the document | |
for (var i = 0; i < pages.count(); i++){ | |
//reference each page | |
var page = pages[i]; | |
//get the name of the page | |
var pageName = [page name]; | |
//show the page name in the console | |
log(pageName); | |
} | |
//show a message in app | |
doc.showMessage("MyPlugin Finished!"); | |
//send an alert message to the application | |
[app displayDialog:"This is an alert box!" withTitle:"Alert Box Title"]; | |
} | |
function alert(title, message){ | |
var app = [NSApplication sharedApplication]; | |
[app displayDialog:message withTitle:title]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment