1

Is there a way to programmatically run a sketch plugin on a sketch file from the command line, in any language?

For example: runCommand --file myfile.sketch --plugin myscript.js
Would run the plugin myscript.js on myfile.sketch

Thank you!

glesage
  • 955
  • 2
  • 16
  • 31

1 Answers1

3

This was added in Sketch 43 & above

$ sketchtool run

Usage: sketchtool run <bundle> <command> [ --application=<path> | -A <path> ] [ --new-instance{=YES|NO} | --no-new-instance | -N {<YES|NO>} ] [ --wait-for-exit{=YES|NO} | --no-wait-for-exit | -W {<YES|NO>} ] [ --context=<string> | -C <string> ]

Run a command from a plugin, inside Sketch.

Arguments:

    bundle            plugin bundle containing the command to run
    command           the command to run

Options:

    --application     The version of Sketch to launch. If not supplied, the default is to use the version containing sketchtool. (optional).
    --new-instance    Launch a new instance of Sketch, even if one is already running. (optional, defaults to NO).
    --wait-for-exit   Wait for Sketch to exit before returning from this command. (optional, defaults to NO).
    --context         JSON dictionary of values to pass in to the plugin. (optional).
Jon Gold
  • 1,173
  • 12
  • 17