Skip to main content
  • 6,384 Posts
  • 12,193 Replies
6384 Posts
Illustratorスクリプト:複数のファイルをオプションを変えて上書き保存する

いつもお世話になっています。javascript勉強中の身ですのでお手柔らかにお願いいたします。 Illustratorで複数のファイルを編集した後、オプションを変えて上書き保存をするスクリプトを書きました。 var options = new IllustratorSaveOptions ; with (options) { pdfCompatible = true ; embedLinkedFiles = false ; embedICCProfile = true ; compressed = true ; } var Doc=app.documents.length; for(var i=0; i < Doc; i++){ app.activeDocument.save(options); app.activeDocument.close(); } 上記のスクリプトで、思っている挙動にはなりました。しかし、使用している中で時々スクリプト自体が動かないことがあるんです。 どういう状況の時に動かなくなるのかは不明なのですが、もしかしたら開いているファイルを上書き保存しようとしているフォルダの指定が違っていたのではないかと考えました。 var options = new IllustratorSaveOptions ; with (options) { pdfCompatible = true ; embedLinkedFiles = false ; embedICCProfile = true ; compressed = true ; for(var i=0 ; i < app.documents.length ; i++){ var Doc = app.documents[i]; var myFile = app.documents[i].fullName ; var path = myFile.fullName ; var file = new File(path); Doc.saveAs(file , options); } なので、上記のように