【问题标题】:Adobe illustrator Script pasteAdobe illustrator 脚本粘贴
【发布时间】:2020-05-31 02:07:57
【问题描述】:

我找到了命令 app.paste() 但它没有返回字符串,它只是粘贴到文档文本中。基本上我需要返回剪贴板的命令!

http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/illustrator/sdk/CC2015_3/Illustrator%20JavaScript%20Scripting%20Reference.pdf

http://prntscr.com/cg5qtb

【问题讨论】:

    标签: adobe


    【解决方案1】:

    我想 Illustrator 中没有返回剪贴板数据的命令。如果您想在不同的应用程序之间复制粘贴,并且如果您只想在 Illustrator 中使用,您可以使用 app.copy()app.paste() 复制 Illustrator 文档中提供的方法。

    【讨论】:

      【解决方案2】:

      app.paste() 导致它创建的新图层成为唯一选定的图层,因此您可以通过返回其.contents 属性来访问文本内容,如下所示:

      #target illustrator
      
      function getClipboard() {
          var doc = app.activeDocument;
          var clipboard = '';
      
          app.paste();
          clipboard = doc.selection[0].contents;
          doc.selection[0].remove();
      
          return clipboard;
      }
      function main() {
          alert( getClipboard() );
      }
      main();```
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-10-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多