Hello, below updated code, i've changed os specific paths to URI notation, hopefully this will fix the compatibility issue. Typescript version here: adobe-forums-scripts/export_images.ts at export_images · lumenn/adobe-forums-scripts · GitHub function displayMessage(text) { var messageWindow = new Window("dialog", undefined, undefined, { borderless: true }); messageWindow.add("statictext", undefined, text); messageWindow.add("button", undefined, "OK"); messageWindow.show(); } function getActiveDocument(app) { if (app.activeDocument) { return app.activeDocument; } else { prompt("There are no opened documents"); } } function getDestinationPath(pathToDocument) { var newPath; var name; name = pathToDocument.split("/").pop(); newPath = pathToDocument.slice(0, -name.length) + "_media"; var checkFolder = new Folder(newPath + "/"); if (checkFolder.exists) { return newPath; } else { checkFolder.create(); return newPath; } } function createImages(document, destPath, filename) { var options = new ExportForScreensOptionsJPEG; options.compressionMethod = JPEGCompressionMethodType.BASELINESTANDARD; options.embedICCProfile = false; options.antiAliasing = AntiAliasingMethod.TYPEOPTIMIZED; options.scaleType = ExportForScreensScaleType.SCALEBYRESOLUTION; options.scaleTypeValue = 150; var prefix; prefix = filename.split("\.").shift() + "!@#$"; var outputFile; outputFile = new File(destPath + "/" + filename); document.exportForScreens(outputFile, ExportForScreensType.SE_JPEG100, options, undefined, prefix); } function moveFilesToParentFolder(rootPath) { var rootFolder = new Folder(rootPath); var filesFolder = new Folder(rootPath + "/150ppi"); var files; files = filesFolder.getFiles(""); for (var i = files.length; i > 0; i--) { var file = files.pop(); if (file.exists) { file.copy(rootFolder + "/" + file.displayName); file.remove(); } } filesFolder.remove(); } function correctFileNames(rootPath) { var rootFolder = new Folder(rootPath + "/150ppi"); var files; files = rootFolder.getFiles(""); for (var i = 0; i < files.length; i++) { var file = files; if (file.exists) { var newName = file.displayName.split("!@#$").shift() + "-" + (i > 9 ? "" : "0") + i + ".jpg"; file.rename(newName); } } } function main() { var activeDocument = getActiveDocument(app); var destPath = getDestinationPath(activeDocument.path.absoluteURI); createImages(activeDocument, destPath, activeDocument.fullName.displayName); correctFileNames(destPath); moveFilesToParentFolder(destPath); displayMessage("Files saved"); } main();
... View more