Localizing Photoshop Folder Names

Photoshop Script Snippets - Note: Full Scripts go in the Photoshop Scripts Forum

Moderators: Tom, Kukurykus

Andrew

Localizing Photoshop Folder Names

Post by Andrew »

I may be using the term localizing wrong. What I want to be able to do is make scripts resiliant to Photoshop default folder names in langauges other than English. In particular, in fact solely, the Presets/Scripts subfolder. Is there an easy way of establishing the language of the users verson of Photoshop and then to obtain the names of these folders according to the language. I had a quick look at the localize function and that doesn't seem to be what it can do, but I might easily have missed something.

Failing a ready built method I guess I can test for the presence of the folder and prompt if it is absent (and save the resulting text to a settings folder).

Andrew
Andrew

Localizing Photoshop Folder Names

Post by Andrew »

Tom Ruark posted the following at the Adobe Bridge forum:

Code: Select allvar strPresets = localize ("$$$/ApplicationPresetsFolder/Presets=Presets");
var strScripts = localize ("$$$/PSBI/Automate/ImageProcessor/Photoshop/Scripts=Scripts");

If anyone is using a foreign langauge version of PS could they confirm that the following yields the path to their scripts folder:

Code: Select allvar strPresets = localize ("$$$/ApplicationPresetsFolder/Presets=Presets");
var strScripts = localize ("$$$/PSBI/Automate/ImageProcessor/Photoshop/Scripts=Scripts");
var scriptfolder = Folder(app.path+ '/' + strPresets + '/' + strScripts);
alert(scriptfolder.fullName);

Andrew
Andrew

Localizing Photoshop Folder Names

Post by Andrew »

Just to complete this, I asked Tom Ruark:

"Do I understand right that the following in Photoshop will give me the default scripts folder regardless of installation language (using your variables above):

var scriptfolder = Folder(app.path+ '/' + strPresets + '/' + strScripts);

And would this work in CS (since I try to make scripts CS compatible)."

His reply was:

"For CS2 yes. I'm not sure about CS. I doubt it."

Andrew
kpt

Localizing Photoshop Folder Names

Post by kpt »

My experience is that the above does not work with CS2 if the user is running a non-English Windows XP.

Example: the above code sets scriptFolder to
Code: Select all/c/Programme/Adobe/Adobe Photoshop CS2/Vorgaben/Scripts/

on a German Windows XP running CS2, which is not right. It should be
Code: Select all/c/Programme/Adobe/Adobe Photoshop CS2/Vorgaben/Skripten/

For this reason I had to change the code to:
Code: Select allvar strPresets = localize ("$$$/ApplicationPresetsFolder/Presets=Presets");
var strScripts = localize ("$$$/PSBI/Automate/ImageProcessor/Photoshop/Scripts=Scripts");

if (isCS2()) {
  if (strPresets.match(/Vorgaben/g))   // German Windows
    strScripts = strScripts.replace("Scripts", "Skripten");
  else if (strPresets.match(/llningar/g))  // Swedish Windows
    strScripts = strScripts.replace("Scripts", "Skript");
}

The function isCS2() is from http://ps-scripts.com/bb/viewtopic.php? ... ight=iscs2