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

Mantain the same name with whitespace

New Here ,
Nov 19, 2013 Nov 19, 2013

I'm trying to make some batch operations on images. All works great, but I noticed that the image name are changed.

When I save my image, if the name contains space, photoshop automatically convert this whitespace to "-". I want preserve my image name, because I have those informations stored in the database and after the change name I cannot find the correct path of the image.

For example an image called "Google Analytics.png" become "Google-Analytics.png" but I DON'T want that extra "-".

This is my script routine:

function SavePNG(saveFile){

    var file = new File(saveFile);

    var pngOpts = new ExportOptionsSaveForWeb;

    pngOpts.format = SaveDocumentType.PNG

    pngOpts.PNG8 = false;

    pngOpts.transparency = false;

    pngOpts.interlaced = false;

    pngOpts.quality = 100;

    app.activeDocument.exportDocument(file,ExportType.SAVEFORWEB,pngOpts);

}

TOPICS
Actions and scripting
578
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 , Nov 19, 2013 Nov 19, 2013

That is controlled by the saveForWeb preferences in Photoshop. As far as I know those preferences can only be changed in the GUI.

With any image open choose File-Save for Web... Then in the flyout menu of the SFW dialog choose Edit Output Settings... In that dialog choose Saving Files from the dropdownlist at the top then uncheck Unix in the Filename Compatibility section. This only has to be done once as the settings are sticky.

Once that setting has been changed your code should export the file

...
Translate
Adobe
Guru ,
Nov 19, 2013 Nov 19, 2013

That is controlled by the saveForWeb preferences in Photoshop. As far as I know those preferences can only be changed in the GUI.

With any image open choose File-Save for Web... Then in the flyout menu of the SFW dialog choose Edit Output Settings... In that dialog choose Saving Files from the dropdownlist at the top then uncheck Unix in the Filename Compatibility section. This only has to be done once as the settings are sticky.

Once that setting has been changed your code should export the file without the underscore.

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
New Here ,
Nov 19, 2013 Nov 19, 2013
LATEST

Hey many thanks!!!

This solved my problem. I was searching that setting in general preferences...you saved me!!!

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