ということで無理やり作ってみた。
1.すでにpsdとして保存されている場所にtgaを保存
2.保存されたtgaの名前をpsdと同じ命名に修正
以上。
[疑問点]
・saveするときに名前の指定はできないのか?
・activeDocumentのドキュメント名は修正できないのか?
・melでいうbasenameEXのような拡張子を除いたファイルネームが取得できるコマンドないの?
・もっときれいに書けないのか?
--------------------------------------------------------------------
oPath = activeDocument.path;
oName = activeDocument.name;
oNewName = oName.split(".");
activeDocument.duplicate();
//tga保存始めるよ
activeDocument.flatten();
oChSize = activeDocument.channels.length;
tgaSaveOptions = new TargaSaveOptions();
tgaSaveOptions.alphaChannels = 1;
if(oChSize == 3){
tgaSaveOptions.resolution = TargaBitsPerPixels.TWENTYFOUR;
}
else if(oChSize == 4){
tgaSaveOptions.resolution = TargaBitsPerPixels.THIRTYTWO;
}
activeDocument.saveAs(oPath, tgaSaveOptions, false, Extension.LOWERCASE);
activeDocument.close(SaveOptions.DONOTSAVECHANGES);
//保存したtgaの名前から" のコピー"を取り除く
srcFilename = (oPath + "/" + oNewName[0] + " のコピー" + ".tga");
newFilename = (oNewName[0] + ".tga");
srcFileObj = new File(srcFilename);
srcFileObj.rename(newFilename);
--------------------------------------------------------------------