Copy link to clipboard
Copied
Hello everyone,
I need a little help 😅
I want to open the Save As dialog via Extendscript with the default settings TIFF and LZW.
Unfortunately, I always have the problem that Photoshop does not remember the new path and when I save the file again later, the file ends up in the old path.?
In addition, it would be nice if the dialog always opened in the last path in which I saved. so actually like when I use the normal Save As dialog from Photoshop.
I hope I was able to explain this clearly and you can help me?
Many thanks in advance
1 Correct answer
You can try something like this for an interactive LZW TIFF save:
try {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
var docName = app.activeDocument.name.replace(/\.[^\.]+$/, '');
try {
var docPath = app.activeDocument.path;
} catch (e) {
var docPath = "~/Desktop/";
}
descriptor2.putEnumerated(s2t("byteOrder"), s2t("platform"), s2t("IBMPC"));
descriptor2.put
...
Explore related tutorials & articles
Copy link to clipboard
Copied
You can try something like this for an interactive LZW TIFF save:
try {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
var docName = app.activeDocument.name.replace(/\.[^\.]+$/, '');
try {
var docPath = app.activeDocument.path;
} catch (e) {
var docPath = "~/Desktop/";
}
descriptor2.putEnumerated(s2t("byteOrder"), s2t("platform"), s2t("IBMPC"));
descriptor2.putBoolean(s2t("LZWCompression"), true);
descriptor2.putBoolean(s2t("saveTransparency"), true);
descriptor2.putEnumerated(s2t("layerCompression"), s2t("encoding"), s2t("zip"));
descriptor.putObject(s2t("as"), s2t("TIFF"), descriptor2);
descriptor.putPath(s2t("in"), new File(docPath + "/" + docName + ".tif"));
descriptor.putBoolean(s2t("lowerCase"), true);
descriptor.putEnumerated(s2t("saveStage"), s2t("saveStageType"), s2t("saveBegin"));
executeAction(s2t("save"), descriptor, DialogModes.ALL);
} catch (e) {
alert("Error: " + e + " Line: " + e.line);
}
Copy link to clipboard
Copied
This Works Great! :heart_suit:
I saved the previous path in a variable and all worked as i want 👍
Thank you very much for your help!!!!
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hello Stephen,
The path in this code is taken from the output file, I have built a small ui and save the path after saving and use it immediately for the subsequent save operations. The only thing that doesn't work is that the saved data appears in the last used list of Photoshop only if I save via Photoshop itself 😞
I have also noticed that if I save too many files via the script, Photoshop crashes at some point. For example, after 50 saves.
Copy link to clipboard
Copied
Ah, that makes sense, I was wondering where/how you were doing that.

