Skip to content

Instantly share code, notes, and snippets.

@joshblack
Last active March 29, 2017 15:33
Show Gist options
  • Save joshblack/7d951b1bfbfd01b0a26e to your computer and use it in GitHub Desktop.
Save joshblack/7d951b1bfbfd01b0a26e to your computer and use it in GitHub Desktop.

Sketch Tips

context

Properties:

  • document
  • selection
  • scriptPath
  • scriptURL
  • plugin
  • command

User Input

var onRun = function(context) {
  var doc = context.document;
  var name = doc.askForUserInput_initialValue('What is your name?', '');
};

Feedback

Basic Window (notification style)

var onRun = function(context) {
  var doc = context.document;
  doc.showMessage('Show message here');
}

Popup Window

var onRun = function() {
  var app = NSApplication.sharedApplication();
  app.displayDialog_withTitle('The operation is complete', 'We\'re done');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment