Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CS3 folders with spaces in the name

Explorer ,
Jul 05, 2009 Jul 05, 2009

I'm having a slight issue with files that are in folders that have spaces in the folder name.

For example the files is in the following location: /c/Hold/Test Image Folder/mondeo n rtu 41%.psd

If I run the script it creates a folder called ScriptFolder in the location on the file and does a saveAs psd file into that folder but I get an error.

General Photoshop error occured. This fucntionality may not ....ld\....\mondeo n 41%" because the file could not be found.

If I change the folder "Test Image Folder" to "Test_Image_Folder" which is where the file is the script works.

Here is the script any suggestions on how I can get around this?

var myPsDoc = app.activeDocument;
var justname = myPsDoc.name.split (".")[0]
var myNewFolder = new Folder(myPsDoc.path+"/ScriptFolder/");
if (myNewFolder.exists){
}else{
    myNewFolder.create();
    }
newFile = new File(myNewFolder+"/"+justname )
photoshopSaveOptions = new PhotoshopSaveOptions()
photoshopSaveOptions.embedColorProfile = false
myPsDoc.saveAs(newFile, PhotoshopSaveOptions, true,Extension.LOWERCASE)

TOPICS
Actions and scripting
716
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , Jul 05, 2009 Jul 05, 2009

Using decodeURI should take care of the problem with spaces in the path.

var myNewFolder = new Folder( decodeURI(myPsDoc.path) +"/ScriptFolder/");

Translate
Adobe
Guru ,
Jul 05, 2009 Jul 05, 2009

Using decodeURI should take care of the problem with spaces in the path.

var myNewFolder = new Folder( decodeURI(myPsDoc.path) +"/ScriptFolder/");

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 05, 2009 Jul 05, 2009
LATEST

Thanks Michael but I'm still getting the same error on decodeURI(myPsDoc.path).

Did a little test using:

changed var myNewFolder = new Folder(decodeURI(myPsDoc.path)+"/ScriptFolder/");

to var myNewFolder = new Folder("/c/Hold/Resize test folder/ScriptFolder");

still got the error.

changed newFile = new File(myNewFolder+"/"+justname)

to newFile = new File("/c/Hold/Resize test folder/ScriptFolder"+"/"+justname)

and the script worked.

so then I tried newFile = new File(decodeURI(myNewFolder)+"/"+justname)

Thanks for you help much appreciated.

Cheers John.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines