| path problems Hello guys and girls,
I started scripting in photoshop with javascript a little while ago. I am currently making a script that automatically saves a copy of a psd as a resized TGA file in a user specified location. To get the file path and name I use a file browser box.
saveFile = File.openDialog("Select a file", "Bitmaps: *.tga");
Now, to make it easier for the user, I want the selected path to be saved with the psd file, so the next time the user wants to save that file, he doesn't have to fill in the path again. To do this, I would like to save
saveFile.absoluteURI (this contains the path as a string)
This works fine for short paths without spaces (eg. c:\test\test.tga).
But when the user selects a path that does contain spaces (eg.
c:\program files\test.tga), the string in saveFile.absoluteURI reads "/c/program%20files/test.tga" and when the path gets a little longer (eg. c:\documents and settings\my name\my documents\test.tga) saveFile.absoluteURI reads "~my%20documents\test.tga" instead of the whole path.
Does anyone know how to get around this problem? |