以编程方式在草图文件上运行脚本

时间:2016-09-23 00:59:24

标签: automation sketch-3

有没有办法以编程方式从命令行以任何语言在草图文件上运行草图插件?

例如:runCommand --file myfile.sketch --plugin myscript.js
会在myscript.js

上运行插件myfile.sketch

谢谢!

1 个答案:

答案 0 :(得分:3)

这是在Sketch 43& amp;上述

$ 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).