【问题标题】:Illustrator scripting document.close() method crashIllustrator 脚本 document.close() 方法崩溃
【发布时间】:2018-01-06 06:11:41
【问题描述】:

在 Illustrator CS6 中,我想将所有选择导出到每个 SVG 文件。 我的顺序是这样的。

  1. 制作临时文档,使用documents.addDocument()方法
  2. ith 选择复制到临时文档。
  3. 使用document.exportFile()方法导出为SVG文件。
  4. 使用document.close()方法关闭临时文档。

但 Illustrator 在到达序列 4 时崩溃。 有什么问题?

var sel = activeDocument.selection;

var arr = new Array;
for(var i=0;i<sel.length;i++)
{   
    arr.push(sel[i]);
}

var preset = new DocumentPreset;
var option = new ExportOptionsSVG;
option.compressed = false;
option.fontType = SVGFontType.OUTLINEFONT;

for(var i=0;i<arr.length;i++)
{
    doc = app.documents.addDocument(i,preset);  //sequence 1
    var item = arr[i].duplicate();          //sequence 2
    item.move(doc,ElementPlacement.PLACEATEND);

    expFile = new File("C:\\Users\\user\\Documents\\font project\\svg\\" + i);

    doc.exportFile(expFile,ExportType.SVG,option);  //sequence 3

    doc.close();    //sequence 4 and it occurs crashes
}

*导出目录存在且为空。

【问题讨论】:

    标签: scripting adobe-illustrator


    【解决方案1】:

    我刚刚在 Illustrator CC 2017 中运行了您的代码,它运行良好。可能是在旧版本的 Illustrator 中存在一些问题。为什么不切换到最新版本的 Illustrator?现在我没有 CS6,但我也会尝试 CS6 并告诉你。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-07-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-24
      • 2013-06-06
      相关资源
      最近更新 更多