Skip to main content
Inspiring
June 29, 2021
Answered

Compatibility with scripts .jsx files

  • June 29, 2021
  • 2 replies
  • 1418 views

Hi

(please excuse me for my bad English, I'm French)

 

I'm using Photoshop CC 20.0.10 and I usually use a JSX script to operate some actions.

 

Here is the begining of my script (just to see the used language):

 

//set unit preferences
var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;
app.preferences.rulerUnits = Units.PIXELS;
app.preferences.typeUnits = TypeUnits.PIXELS;
 
//Set the cancelled flag
var isCancelled = false; 
 
//Container var for the sharpening
var sharpLayer;
 
/////////////////////////////////////////////////////////////////////////////////////////////
 
//clean up input text with safe html characters
// http://www.utexas.edu/learn/html/spchar.html
function cleanTxt(txt)
{
    if(txt != null)
        {
            //replace unsafe characters
            var clean = txt;
            clean = clean.replace(/\"/gi,""");
            clean = clean.replace(/\'/gi,"'");
            clean = clean.replace(/\</gi,"&#60;");
            clean = clean.replace(/\>/gi,"&#62;");
            clean = clean.replace(/\é/gi,"&#233;");
            clean = clean.replace(/\è/gi,"&#232;");
            clean = clean.replace(/\à/gi,"&#224;");
            clean = clean.replace(/\â/gi,"&#226;");
            clean = clean.replace(/\ç/gi,"&#231;");
            clean = clean.replace(/\ë/gi,"&#235;");
            clean = clean.replace(/\ê/gi,"&#234;");
            clean = clean.replace(/\î/gi,"&#238;");
            clean = clean.replace(/\ô/gi,"&#244;");
            clean = clean.replace(/\û/gi,"&#251;");
            clean = clean.replace(/\©/gi,"&#169;");
            clean = clean.replace(/\®/gi,"&#174;");
            clean = clean.replace(/\™/gi,"&#153;");
            clean = clean.replace(/\‘/gi,"&#8216;");
            clean = clean.replace(/\’/gi,"&#8217;");
            clean = clean.replace(/\«/gi,"&#171;");
            clean = clean.replace(/\»/gi,"&#187;");
            clean = clean.replace(/\ï/gi,"&#239;");
            clean = clean.replace(/\ï/gi,"&#239;");
            clean = clean.replace(/\ù/gi,"&#249; ;");
        return clean;
        }
}

 

This script seems to be not compatiblr with the latest Photoshop version 22.4.2 ?

 

Thanks

 

 

This topic has been closed for replies.
Correct answer Kukurykus

 

cleanTxt('\"\'\<\>\é\è\à\â\ç\ë\ê\î\ô\û\©\®\™\‘\’\«\»\ï\ï\ù')

 

2 replies

Inspiring
June 29, 2021

Thanks all for you help.

I installed the new version, removed the cleanTxt Function and put my scripts into the folder /Presets/Sripts and it works !

 

Kukurykus
Brainiac
June 30, 2021

Then please mark the post where that was suggested as correct answer 😉

Kukurykus
KukurykusCorrect answer
Brainiac
June 29, 2021

 

cleanTxt('\"\'\<\>\é\è\à\â\ç\ë\ê\î\ô\û\©\®\™\‘\’\«\»\ï\ï\ù')

 

Inspiring
June 29, 2021

Excuse me but I do not understand your answer...

 

I understand that you told me to replace clean.replace by clean.txt, ok why not, but my problem is not just this change, my probleme is that the latest CC Cloud Photohop do no recognize the while scripts...

 

Thanks

Kukurykus
Brainiac
June 29, 2021

I have the same Photoshop version and I see converted characters, so those starting with '&#'.