Quickstart: automating#
On this page
Turn a drawing into a script, record a session, and draw with no window at
all. The Automate menu writes napkin script from what is on the page;
the napkin-sketch command draws napkin script without opening the app.
Automate and Drawing from a
script have the full detail.
1. Write a script from a file#
- Choose Automate > Generate Script > From Media File and pick an SVG, a PDF or a picture.
- The Generated script dialog shows the whole script, a line counting its instructions, marks and layers, and a note for anything the language cannot say as the file does.
- Copy puts it on the clipboard, Save As writes a
.napkinfile, and Open as New Page runs it into a page of its own - the honest way to see what it draws.
A picture is placed, not traced: its script links the file by name, or with Embed the image data ticked, carries the picture itself.
2. Write a script from the selected layers#
- Light one or more rows in the Layers panel.
- Choose Automate > Generate Script > Selected Layers.
- Choose Page: fit to the selection to write a page the size of what you chose, moved to its corner, or keep the page as it is.
3. Record a session#
- Choose Automate > Track History; the row shows a check mark while it records.
- Draw a couple of strokes and turn one with
Ctrl + R. Each is a step, named for what made it: "Brush stroke", "Rotate". - Automate > History Limit opens Verbose Settings at its Automate section, where the limit is set and the steps are counted.
4. Write the session as a script#
- Choose Automate > Generate Script > From Session History.
- Every step recorded on the page is listed, ticked. Untick a step to leave it out: the script is then the drawing as it would be had that step not happened.
- Press Accept to see the script in the Generated script dialog.
5. Draw a script with no window#
Save this as card.napkin:
napkin 1
page 400 240
layer "Card"
color #1f2328 width 3 fill #ffe08a
rect 20 20 360 200 r 12
text "Hello" at 200 130 size 32 align center
Then, from the folder it is in:
napkin-sketch draw card.napkin --to svg,png --out out # writes out/card.svg and out/card.png
napkin-sketch check card.napkin # reports mistakes, draws nothing
napkin-sketch verbs # every verb the language has
None of the three loads Electron, so they run in a shell, a batch file or CI.
Where next#
- API quickstart - the whole drawing language in five steps.
- The command line - every option the app itself takes.
- Animation Mode - the optional add-on that draws a character a frame at a time: the six assemblies a character needs, and the names its frames take.