Copy link to clipboard
Copied
I have this code:
Copy link to clipboard
Copied
I rarely script for solely for Windows OS, most of my work is cross-platform, so I'm not sure if the following will help or not...
var path = new File("\\C\\Maps to upload.psd")
// or
var path = new File("/C/Maps to upload.psd")
Perhaps script writing directly to C:\ is not permitted by Photoshop or scripting?
Copy link to clipboard
Copied
When you use the name path for a variable, you are referencing the read-only property app.path,
so:
if (!app.activeDocument.saved) {
var options = new PhotoshopSaveOptions()
var pth = new File("c:/Maps to upload.psd")
app.activeDocument.saveAs(pth, options)
}
alert(app.activeDocument.path)
Copy link to clipboard
Copied
@jazz-y – good catch!
Thus the preference for variable names such as myPath or thePath or docPath etc to play it safe if one can't remember the reserved names... or even Path as this is case sensitive.
Copy link to clipboard
Copied
That's right, I've fallen for this trap more than once 😉