Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

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

$
0
0

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:

https://dl.dropboxusercontent.com/u/55743036/emptyframeremover.jsx

 

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:

Non-empty.png

 

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)

        myGraphicFrames[i].remove();

}

 

and the trick further repeated twice...

 

---

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


Viewing all articles
Browse latest Browse all 15932

Trending Articles


FLASHBACK WITH SIRASA FM AT GALGAMUWA 2022


Mp3 Download: Mdu - Mazola


Imitation gun was fired at motorist in Leicester road-rage incident


Ndebele names


MCKINNEY EMALINE “EMMA” OF WES...


Okra & Motia — The Workshop (Prod by Hammer)


Skint TV teen to be sentenced


Moondru Mudichu 19-09-2017 – Polimer tv Serial


YOSVANI JAMES Arrested by Miami-Dade County Corrections on Jan 10, 2017


Stories • Goddess Stepmom



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>