Code to be evaluated! [004] // Round numbers! …


hi scripters,

 

something wrong: can't find way (surely obvious) replace numbers rounded values!! 

 

 

var mydoc = app.activedocument;   app.findgreppreferences = app.changegreppreferences = null; app.findgreppreferences.findwhat = "\\d+\\.\\d+"; var myfound = mydoc.findgrep();   (n = 0; n < myfound.length; n++){         var mynum = myfound[n].contents;         mynum = roundnumber (mynum); };   app.findgreppreferences = app.changegreppreferences = null;   function roundnumber (number)       {       number = math.round(number (number));       return number;       } 

 

 

thanks in advance!

 

(^/)

code given trevor, 3 years ago!

 

re: possible script decimal approximation in indesign?

 

thanks trevorׅ!

 

(^/)

 

var mydoc = app.activedocument;   app.findgreppreferences = app.changegreppreferences = null; app.findgreppreferences.findwhat = "\\d+\\.\\d+"; var myfound = mydoc.findgrep(); n = myfound.length;   while (n--)       {           app.changegreppreferences.changeto = math.round(myfound[n].contents).tostring();           myfound[n].changegrep();       } app.findgreppreferences = app.changegreppreferences = null; 


More discussions in InDesign Scripting


adobe

Comments

Popular posts from this blog

Reader DC

AdobeIDの作り方

Adobe InDesign CC 2017 has stopped working