Quantcast
Channel: Adobe Community : All Content - InDesign
Viewing all articles
Browse latest Browse all 62281

Possible to Delete Empty Text Frames via a Script?

$
0
0

I've seen a few posts on similar topics, but I'm not sure if they were exactly the same. I am running Mac OS 10.5.8, InDesign CS 4 ver 6. Often our InDesign documents start (from an XML load into a InDesign template) with some empty text frames that we end up manually deleting. I saw the script below on these forums and gave it a try to automate deleting the empty frames - it looks like it should do what I need, but I get this error:

 

JavaScript Error!

 

Error Number: 1

Error String: contentType

 

File: Applications/Adobe InDesign CS4/Scripts/Scrips Panel/RemoveEmptyFrames.jsx

Line: 7

Source: if (myTextFrames[0].contents == "") myTextFrames[0].conentType = ContentType.UNASSIGNED.

 

Does anyone have advice on how to make this work?

 

 

var myStories = app.activeDocument.stories.everyItem().getElements();
for (i = myStories.length - 1; i >= 0; i--){
    var myTextFrames = myStories[i].textContainers;
    for (j = myTextFrames.length - 1; j > 0; j--)    {
        if (myTextFrames[j].contents == "") myTextFrames[j].remove();
        }
    if (myTextFrames[0].contents == "") myTextFrames[0].contentType = ContentType.UNASSIGNED;
    }


Viewing all articles
Browse latest Browse all 62281

Trending Articles



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