2 Replies Latest reply on Jan 12, 2009 4:12 PM by Loic.Aigon

    [JS CS3] "Working on characters arrays" slowness matter

    Loic.Aigon Adobe Community Professional
      Hi, <br />I am trying to write a script randomizing the baseline shift for all characters given a text frame. <br /><br />http://www.imagefreehost.com/files/13012009/kt28579628821.jpeg<br /><br />The script works but it's very time consuming meanwhile the text frame "only" contains a thousand characters.<br /><br />for(i=0; i<app.selection[0].texts[0].characters.everyItem().getElements().length; i++)<br />{<br />     app.selection[0].texts[0].characters.everyItem().getElements()[i].baselineShift = posMe();<br />}<br /><br />function posMe()<br />{<br />     var myPosArr = ["-2","-1.75","-1.5","-1.25","-1","-0.75","-0.5","-0.25","0","0.25","0.5","0.75","1","1.2 5","1.5","1.75","2"];<br />     var nb = Math.round((Math.random()*(16-0)+(0)));<br />     return myPosArr[nb];<br />}<br /><br />Is there any approach that can speed up the process ?<br /><br />Thanks in advance<br />Loic