User's Guide: User Scripting

Configuration | User's Guide |

# User Scripting

Sketch lets you write scripts to automate tasks and add new functionality. The programming language for these scripts is Python, an interpreted, object oriented language.

This chapter explains how to write such scripts and how they end up in the Scripts menu, so that you can invoke them. I'll assume that you already know how to program in Python. If you don't know that yet, have a look at Python's webpage for online documentation.

Some parts of this feature are still experimental and may change substantially in newer releases, so watch the NEWS file and the sample scripts in case this documentation is outdated.

Sketch itself is implemented almost completely in Python, so your scripts have access to all areas of the application, including internal data structures. This makes user scripts very powerful, but it also means that they can mess around with Sketch's internals with the result that Sketch might not be able to undo the changes or even save the document. But don't worry, evading the traps is not that difficult (I think) and this chapter tries to explain to avoid them.

#### Introduction

#### The Example Scripts

#### The Script Registry

#### Sketch's API

#### Common Tasks

Configuration | User's Guide |