2017-07-30 9 views
0

Illustrator CS6では、すべての選択を各SVGファイルにエクスポートします。 私のシーケンスはこれです。scripting document.close()method crash

  1. 一時的な文書に選択の目documents.addDocument()方法
  2. コピーiを使用して、一時的な文書を作成します。
  3. document.exportFile()メソッドを使用してSVGファイルとして書き出します。
  4. document.close()メソッドを使用して、一時的な文書を閉じます。

しかし、シーケンス4になるとIllustratorがクラッシュします。 何が問題ですか?

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 
} 

*エクスポートディレクトリが存在し、空です。

答えて

0

私はIllustrator CC 2017でコードを実行していますが、正常に動作しています。 Illustratorにはいくつかの問題があります。なぜIllustratorの最新バージョンに切り替えるのですか?今私はCS6を持っていませんが、私はCS6も試してみましょう。