Run a script
Sketch can run scripts from two places:
- The built-in script editor in the Plugins menu
1. Write a script using the built-in script editor
- Open a new or existing file in Sketch
- Select Run Script… from the Plugins menu or use the keyboard shortcut
control + shift + kto bring up the code editor
- Paste in the code below
const sketch = require('sketch') sketch.UI.message('Hello Sketch 👋')
2. Run the script
Click Run in the script panel or use
command + return keyboard shortcut and a message will be shown at the bottom of your Sketch Document window saying Hello Sketch 👋.
3. Save the script as a plugin
Save the script as a plugin to use it later by clicking the Save button in the Run Script… panel.
- Enter a name for the plugin, e.g. show message
- Click Save
The newly created plugin is now available from the Plugins menu.
Check out these resources to learn more about plugins.