3 Replies Latest reply on Mar 2, 2011 12:04 PM by Nina Storm

    Script converting decimal separators

    Nina_Storm Level 1

      Hi

       

      I found a perfect script the other day which changed decimal separator from UK and EU and vise versa.

       

      Now I need it urgently and I only downloaded it to my homecomputer and I cannot find the site where I downloaded it.

       

      Can you help?

       

      Nina Storm

        • 1. Re: Script converting decimal separators
          Nina Storm Level 1

          Well at home I found out that Peter Kahrel did the swop_thousands_decimals script.

           

          Works like a charm.

           

          Thank you Peter Kahrel :-)

          • 2. Re: Script converting decimal separators
            Nina Storm Level 1

            Is it bad behaviour to ask if someone could help making af variation of Peter Kahrels scripts making i change from 0,0 to 0.0

             

            His scripts is:

            __

             

            //DESCRIPTION: Exchange commas and periods in numbers
            // Peter Kahrel -- www.kahrel.plus.com

             

            #target indesign;

             

            try {main ()}
            catch (_){alert ("Can't run.")}

             

            function main (){
                function FindItems (){
                    if (app.selection.length == 0) {return app.activeDocument.findGrep();}
                    if (app.selection[0].hasOwnProperty ("baseline")) {return app.selection[0].findGrep();}
                    if (app.selection[0] instanceof TextFrame) {return app.selection[0].parentStory.findGrep();}
                    exit ();
                } // FindItems

             

                // BEGIN main
                app.findGrepPreferences = app.changeGrepPreferences = null;
                app.findGrepPreferences.findWhat = "\\d+[,.\\d]+\\d+";
                var Found = FindItems ();
                var Temp;
                for (var i = Found.length-1; i >= 0; i--)
                    {
                    Temp = Found[i].contents.replace (/,/g, "#");
                    Temp = Temp.replace (/\./g, ",");
                    Found[i].contents = Temp.replace (/#/g, ".")
                    }
                } // main

             

            ___

             

            BR Nina Storm

            • 3. Re: Script converting decimal separators
              Nina Storm Level 1

              ;-)

               

              I see - the script does both in one shot. Converts decimal separators to its opposite as the script says.

              Nice tool.

               

              Nina Storm