Danke, bin auch gerade darauf gekommen und wollte das Ergebnis posten.
trim() funktioniert in PS leider nicht.
Code:
try {
// Ask user for input folder
var inputFolder = Folder.selectDialog("select Folder");
var fileList = inputFolder.getFiles("*from*");
for (var i = 0; i < fileList.length; i++) {
// split example
var explodedName = fileList[i].name.split("from");
var newText = explodedName[0] +String.fromCharCode(13)+"from"+String.fromCharCode(13)+explodedName[1];
//var newText = fileList[i].name;
var fontName = "Philosopher";
var clearName = newText.replace (/%20/g, " ");
var clearerName = clearName.replace (/.mp4/g,"");
var newTextLayer = docRef.artLayers.add();
newTextLayer.kind = LayerKind.TEXT;
newTextLayer.textItem.contents = clearerName;
newTextLayer.textItem.position = Array(200, 450);
newTextLayer.textItem.size = 36;
newTextLayer.textItem.color = textColor;
newTextLayer.textItem.font = fontName;
saveFile = new File("/C/2 CC Attribution Share Alike/"+fileList[i].name.replace (/.mp4/g,"")+".jpg");
saveOptions = new JPEGSaveOptions();
saveOptions.embedColorProfile = true;
saveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
saveOptions.matte = MatteType.NONE;
saveOptions.quality = 9;
activeDocument.saveAs(saveFile, saveOptions, true,Extension.LOWERCASE);
//activeDocument.close(SaveOptions.DONOTSAVECHANGES) ;
newTextLayer.remove();
}
}
trim() funktioniert in PS leider nicht.