Copy link to clipboard
Copied
Hi,
I have a very simple script that would save the changes in a PS document. The script is as practically as mentioned below :
if(app && app.activeDocument) {
app.activeDocument.save();
}
This was working fine. But all of a sudden, I started getting the error - Error : The document has not yet been saved. The file on which I am trying to run the script is located in /Users/qa/Documents/sample.psd. The file is already saved on disk and am running the script after making some changes to the file. I am using the Photoshop CC 2014 and Mac OS X version 10.10. This is a show-stopper for me and I need to resolve this urgently. Looking forward to any help.
Thanks in advance.
Copy link to clipboard
Copied
Could it be a permissions issue?
Have you tried using a try-clause and in case of an error using saveAs instead?
Copy link to clipboard
Copied
Sounds like a general "something went wrong and dont know what to do"-error, which can be difficult to solve. Try to narrow it down in exactly what conditions it happens:
- Comment that line, run script and save from PS menu (sometimes PS can give more informative errors)
- Try rebooting computer and running freshly started Photoshop
- Try copying file in Finder and running it for that
- Try running from different folder like Desktop
- Try CC 2012
- Try commenting out script operations that change the doc one at the time
Idea is to see what things could make the issue go away
Copy link to clipboard
Copied
Thanks for your inputs. I did try to use saveAs instead. Also tried different options - restarting PS, rebooting machine etc, none of which worked. Finally got the save operation to work by using the Action Manager code that gets generated using the ScriptListener. That piece of code seemed to work fine. Still don't have any idea why the .save() method was not working. Will look into it again when I get some time.