【问题标题】:Programmatically run a script on a sketch file以编程方式在草图文件上运行脚本
【发布时间】:2023-03-17 23:28:01
【问题描述】:

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

例如:runCommand --file myfile.sketch --plugin myscript.js
将在myfile.sketch 上运行插件myscript.js

谢谢!

【问题讨论】:

    标签: automation sketch-3


    【解决方案1】:

    这是在 Sketch 43 及更高版本中添加的

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-08-04
      • 1970-01-01
      • 2013-02-28
      • 1970-01-01
      • 1970-01-01
      • 2011-04-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多