Skip to main content
Participant
August 31, 2020
Question

Error of unsaved new created file

  • August 31, 2020
  • 3 replies
  • 1328 views

Hi Team,

 

I'm developing an internal extension for my company. The extension allow user to open psd document inside it. But I'm facing an weird adnormal case. When user create a new PSD document and doens't save it, then continue to open an existing document from my extension. Following error message is shown up.

"The document has not yet been saved."

 

Currently, I'm using app.open() function to open an existing document with known file path. Any idea how I can overcome above incident?

 

Thanks for reading my question,

This topic has been closed for replies.

3 replies

Kukurykus
Legend
September 8, 2020
JJMack
Community Expert
Community Expert
August 31, 2020

I would think a message like  "The document has not yet been saved." Would come from a script or extension that need to use the Document backing files path for some reasons but finds the current document is a new document that has never been saved so there is no backing file.  If the user tried to save the document and it did not you need the find out why save as failed.  If save as works photoshop changes the document name to reflect the save file and there is a recorded backing file.

 

Here I opened a RAW file as an object. ACR open a new document with the mane ImageName-1 no CR2 extension no backing file exists it a new document the document name in Photoshop has no .extension. I added a sharpening adjustment layer then used the shortcut Shift+Ctrl+S Save As and saved it to my desktop as a psd file. You can see the open document  name has been changed to ImageName-1.psd. I closed the document and opened the same RAW as a normal Background layer. Again ACR open a new Document  ImansName-2 there is no backing file. I then Ran the Image Processor Pro plug-in to save it.  I was expecting it to fail for it was a new documen ImageName-2.   Image proceesor pro did fail but not because it was a new document.  Image Processor Pro found the Document was opened from c:\ImageName.cr2.    Image processor pro was not trying to save ImageName-2.psd  It was trying to save ImageName.psd in the root of C:.  It failed because I keep that test raw file in the root of my boot disk.  My user ID does not have write permissions there. Still the meaasge  you saw was because the current document was new never saved.

 

 

 

</ImageProcessorProSettings>
2020-08-31T09:35:56 - Processing: LO2G5037-2 copy
2020-08-31T09:35:56 - saving C:\LO2G5037.CR2 as C:\LO2G5037.psd
2020-08-31T09:35:56 - 
==============Exception==============
   Message: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.
- Could not save a copy as "C:\LO2G5037.psd" because the file is locked, you do not have necessary access permissions, or another program is using the file. Use the ‘Properties’ command in the Windows Explorer to unlock the file.

 

 

 

 

JJMack
Participant
September 1, 2020

Hi JJMack,

 

Thanks for your detail explaination. But I'm pretty sure this is not my case.

If I work on Photoshop without extension, I can open any existing files without caring about unsaved openning files.

So it should work same way with using extension. Let me know if you need any further information.

 

Thanks,

JJMack
Community Expert
Community Expert
September 1, 2020

If you open a file the file exists it is not a new document. If you duplicate it you give the duplicat document some new name and the document has the same content as the original. However it is a new document that has never been saved. There is no file on you disk for the document till you save the docment. Then it is not a new document for there is a file on you disk. There  may be an exception.  If you use save as and save a layerd document as a jpeg  or png  or some other flat file the flat file will be save. However, the document still open in Photoshop will be layered and still new for there is no file on you disk backing the layred document.

JJMack
Inspiring
August 31, 2020

Hi, you've also posted this message over in the Flex forum. So which is it? Does the extension run in PS or in Flex?

If you're running it in Flex, you might need to explicitly target photoshop every time your users trigger the script.

 

Participant
August 31, 2020

Hi Jef,

 

I posted in Flex by mistake and cannot delete it. Sorry for my bad.

I'm doing this in Photoshop by the way. Do you have any how to resolve this?

 

Thanks

Inspiring
August 31, 2020

I'd like to help think along but I don't have an answer based on your information. 🙂
Ok, so it runs in Photoshop.

What do you mean by Extension? Are you using any of these: CEP, CC SDK? Or are you writing everything "from scratch?"

 

A first guess without looking at any of your code (hint hint...) is that your extension might not check the currently opened documents before doing something. Ie: when people use your extension, it does things without first checking it's environment. That's just a guess though... If you don't check whether there are more documents opened in PSI think you should add one. In which case, look at activeDocument.saved and activeDocument.path to see whether something is saved or not and app.documents.length to check the number of currently opened documents.

 

All the best!