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


hi here,

 

please consider sequel pretty old, 'answered' , lenghty thread http://forums.adobe.com/thread/920269?tstart=0.

 

cdflash compiled nice script there:

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

 

it trick... of times.

i found worth add try/catch wrapper lines 16-24, because:

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

js error24on16.png

if there @ least 1 text frame in doc (empty or not, doesn't matter), script works expected. if not, better have lines 16-24 wrapped, won't hurt anyway.

 

now bad news:

recently, working on real-world document (not test!) stumbled on case this:

non-empty.png

 

so: if paste into empty (no fill, outline, etc.) box image it's own frame, or native id object, script happily remove whole thing. no good. shouldn't touched @ all.

yeah, such design serve sample of bad workflow, but... isn't buzz about?

 

as far understand (not much), piece of code should 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 trick further repeated twice...

 

---

... colin, still eager party?

@winterm – hah!
finally real-world example…

 

for testing reasons think need idml, indesign file or @ least snippet (idms) file.

 

can share download?
or @ least send me zipped idml via mail.
just send me personal message before.

 

uwe



More discussions in InDesign Scripting


adobe

Comments

Popular posts from this blog

Could not place because the source rectangle is empty

Thread: Using smartcard reader with vpnc

Adobe Font Folio 7.0 or just 7?