Thank you Karl.
I did say at the end of my post, that I had a thought you might mens to wrap the '/' in its own quotes, and of course you did. Once I changed my code, viola!. It worked.
Until I tried to save it!!!
I CAN'T use "/Users/username/Desktop/" instead of just "/Desktop/" because I don't know the name of the user. It's going to be used an another machine, so I require a versatile path name. Surely there's something in Java that allows this?
There IS a Desktop in MacOS, 'path to desktop as text' is a common used command when accessing the desktop and automatically generates the Desktop path, for the user.
However, is this the reason the new file gives a 'can't save' error? Or, is the file actually locked?
AND, I have checked the new file path, just before trying to save the referred file. I got up early this morning to read through any Java Script documentation I could, but could not find answers.
Regards
Santa
There is no "/Desktop" folder - you need to read exactly what I typed. I did not say that there was no Desktop folder. That's different, and when it comes to programming, these small differences are important. When it comes to Unix paths (or what you refer to as Posix paths in AppleScript), a path that start with a '/' always means that it is in the "root" directory of the disk. What I said was that there is no "Desktop" folder in the root directory, which does not mean that there is no Desktop folder in a user's home directory. Every user on Mac OS does have a Desktop folder, but that is referenced differently (e.g. /Users/username/Desktop).
Take a look at the App.getPath() method: Acrobat DC SDK Documentation
This is all there is in terms of asking Acrobat about user specific (or application specific) paths. Unfortunately, there is no function to get the user's Desktop. There is however a function to get the user's Documents directory, which on a Mac is on the same level as the user's Desktop. This means you could get the Documents directory and then just replace "Documents" with "Desktop":
var pathToDesktop = app.getPath("user", "documents").replace("Documents", "Desktop");
This is dangerous, because the next version of Mac OS X could move Documents, or a user could have reconfigured Mac OS X to store Documents in a different location. This is one area where you could use your AppleScript wrapper to your advantage and get the path to the desktop as a Posix path. (e.g. set pp to POSIX path of (path to desktop) as text )
As to why you are getting error when trying to save - until you fix your path problem, it's impossible to say if that is caused by a non-existing folder ("/Desktop") or something else.