Skip to main content
Serg9
Known Participant
November 13, 2019

P: Jsx can't save document to path containing 'cloud-content'

  • November 13, 2019
  • 13 replies
  • 750 views

Adobe Photoshop version: 21.0.1 20191106.r.47 2019/11/06: 3152b481f18  x64
OS: Windows 10 64-бит
OS version: 10 or more 10.0.18362.329

sample jsx code

app.documents.add(100,100);
app.activeDocument.saveAs(new File( "C:\\cloud-content1\\asd.psd"));

The folder C:\cloud-content1\ exists and it's allowed to write in this folder.

Expected result: file saved to the specified path
Actual result: error, approximate translation of message is:
Can't save as "/cloud-countent1/asd.psd": file not found.

The same error occurs for many variations of the file path, such as C:\\cloud-content\\asd.psd", C:\\cloud-contentasdf\\asd.psd" and so on.


When saving manually from the Photoshop UI - works fine.

This topic has been closed for replies.

13 replies

Legend
January 31, 2022

Fixed in 21.0.2 or later

Legend
November 15, 2019
Yeah this folder should be in userland. What I'm getting at is that cloud sync folders can be problematic. We see people wanting to work directly in a dropbox folder and then having problems, for example.
Tom Ruark
Inspiring
November 15, 2019
@74350? I'm not sure what you mean. I would NOT have a cloud-content (my mistake saying cloud-document above) folder at the root of any drive. There is a "local cloud" folder if you look at app.cloudWorkAreaDirectory. This is to store files locally that cannot be stored in the cloud. There is also a per document activeDocument.cloudWorkAreaDirectory (a place to put side car files for this document) and activeDocument.cloudDocument (tells you this document is in the cloud)
Legend
November 15, 2019
But these files can be moved in the Finder/Explorer, correct?
Tom Ruark
Inspiring
November 15, 2019
Yes. I argued against this magic folder. But cloud-document at the root of any drive is not allowed for non psdc files.
Yes. I argued for that as well. "I want to save all my cloud docs locally. Let me iterate the cloud!" Hopefully, that will come soon!
Serg9
Serg9Author
Known Participant
November 15, 2019
You cannot save a cloud document, psdc, locally
No, in the remark above I saying not about cloud psdc, but about simple local psd.

Steps
* create PSD
* try to it to to local disk C:\ in the local folder called "cloud-content", so the path (local path, no cloud) will be C:\cloud-content\test.psd. Yes, it is a little bit strange name for the local folder, but why not?

app.documents.add(100,100);
app.activeDocument.saveAs(new File( "C:\\cloud-content\\asd.psd"));
* this code will throw an error.

Just again - no cloud functionality here at all, just trying to save local file, but due to "magic words" in the path the operation fails.

I also can replase saveAs call with tha AM-code (also without referencing any cloud-specific entities such as "cloudPSDFormat") - and it also will fail.


So how does a user backup cloud files?
No problem with this. You can "Save as" cloud psdc file as local psd file via the Photoshop UI or via the jsx code with document.saveAs (but you should specify the target path which is not containing "magic" word "cloud-content".




Legend
November 14, 2019
So how does a user backup cloud files?
Tom Ruark
Inspiring
November 14, 2019
You cannot save a cloud document, psdc, locally. They only go in the cloud. psd files and all others can not go in the cloud.
Serg9
Serg9Author
Known Participant
November 14, 2019
Yes, this AM code works fine and saves in cloud. Thank you.
---
In additional to the original report: if I want to save *local* file in the path "C:\cloud-content\test.psd, it still fails. And I could not workaround this with AM code (with your code with removed idcloudPSDFormat, or with the code captured with script listener). It's a strange desire to save file to the such special local path, but who knows, may be this remark will be helpful for your debugging. 


Tom Ruark
Inspiring
November 14, 2019
Yes. I have the same problem. Let me look into it. Try this routine in the meantime:
function SaveInCloud( inFile ) {
    var idsave = stringIDToTypeID( "save" );
    var desc391 = new ActionDescriptor();
    var idas = stringIDToTypeID( "as" );
    var desc392 = new ActionDescriptor();
    var idcloudPSDFormat = stringIDToTypeID( "cloudPSDFormat" );
    desc391.putObject( idas, idcloudPSDFormat, desc392 );
    var idin = stringIDToTypeID( "in" );
    desc391.putPath( idin, inFile );
    executeAction( idsave, desc391, DialogModes.NO );
}