7 Replies Latest reply on Jan 14, 2014 12:02 PM by winterm

    Cleaning up (not only) text frames, Pt. 2

    winterm Level 5

      Hi to all here,


      Please consider this as a sequel to pretty old, 'answered' and lenghty thread http://forums.adobe.com/thread/920269?tstart=0.


      cdflash compiled a nice script there:



      it does the trick... most of the times.

      I just found it worth to add try/catch wrapper to lines 16-24, because:

      start new doc, create empty (no fill, outline, etc.) graphic/unassigned frame(s), run script. You'll get this error:

      JS error24on16.png

      If there is at least one text frame in a doc (empty or not, doesn't matter), script works as expected. If not, you better have lines 16-24 wrapped, it won't hurt anyway.


      Now the bad news:

      Recently, working on a real-world document (not a test!) I stumbled on a case like this:



      So: if you paste into empty (no fill, outline, etc.) box image with it's own frame, or any native ID object, the script will happily remove the whole thing. No good. It shouldn't be touched at all.

      Yeah, such design most often could serve as a good sample of a bad workflow, but... isn't that what is all this buzz about?


      As far as I understand (not much), this piece of code should be modified:



      var myGraphicFrames = app.activeDocument.rectangles;

      for (i=myGraphicFrames.length-1; i>=0; i--) {

      var stroke = myGraphicFrames[i].strokeWeight;

      var color = myGraphicFrames[i].fillColor.name;

      var tpath = myGraphicFrames[i].textPaths.length;

      var wrap = myGraphicFrames[i].textWrapPreferences.textWrapMode;

          if (myGraphicFrames[i].graphics.length < 1 && stroke == "0" && color == "None" && wrap === TextWrapModes.NONE && tpath == 0)




      and the trick further repeated twice...



      ... Colin, are you still eager for the party?