我一直找不到与我明显的小众案例相似的任何东西。
我有很多 .png 文件,所有这些文件都具有矩形或方形透明度。我创建了一个脚本来查找边界,并将此信息写入文本文件。
目前的行为是脚本为每个图像创建一个文本文件,并将我需要的信息写入该文件。
目前代码如下:
//Create logfile FOLDER on the desktop
var LogFolder = new Folder(Folder.desktop + "/LogFiles/");
if(!LogFolder.exists) LogFolder.create();
//NOTE TO SELF: Would be optimal if appended to single log file
//Create new LOGFILE in the folder using image name
var Loginfo = new File(Folder.desktop + "/LogFiles/" + activeDocument.name.replace(/\.[^\.]+$/, '') + ".txt");
Loginfo.open("w", "TEXT");
//Write the info to the file
Loginfo.write(activeDocument.name.replace(/\.[^\.]+$/, '') + ", " + selectionWidth + ", " + selectionHeight + ", " + selectionTopLeftXOffset + ", " + selectionTopLeftYOffset);
//Close the log
Loginfo.close();
.
我已经开始研究它,但没有运气将它附加到单个文件:
//Create logfile FOLDER on the desktop
var LogFolder = new Folder(Folder.desktop + "/LogFiles/");
if(!LogFolder.exists) LogFolder.create();
//Append to LOGFILE
var Loginfo = new File(Folder.desktop + "/LogFiles/" + "coords.txt");
Loginfo.open("w", "TEXT");
//Write the info to the file
Loginfo.write(activeDocument.name.replace(/\.[^\.]+$/, '') + ", " + selectionWidth + ", " + selectionHeight + ", " + selectionTopLeftXOffset + ", " + selectionTopLeftYOffset + "\r");
//Close the log
Loginfo.close();
.
附加到单个文件将使创建文件之后的工作变得更加容易。任何帮助将不胜感激。