Delete Text Frame out of page

I want to delete text frame either is blank or have text that out of the page in all opened document, below script can delete all text frame in all opened document, but I want to keep the text frame inside the page, can anyone help me?
var myDoc = app.documents.length;
for (var k= myDoc -1; k >= 0; k--) {
var myStories = app.documents[k].stories.everyItem().getElements();
for (i = myStories.length - 1; i >= 0; i--){
    var myTextFrames = myStories[i].textContainers;
    for (j = myTextFrames.length - 1; j >= 0; j--)    {
            myTextFrames[j].remove();

Hi creativejoan0425
Give this script a try:
It delets all Textframe which are totaly off a page
It delets all empty Textframes
Script works for multiple document and multiple pages.
main();
exit();
function main() {
     var myDocs = app.documents.everyItem().getElements();
     for (var j = myDocs.length -1;  j >= 0; j--) {
          var myTextFrames = myDocs[j].textFrames.everyItem().getElements();
          for (var i = myTextFrames.length -1; i >= 0 ; i--) {
                // is null, if the textfame is totaly off the pagae
               if (myTextFrames[i].parentPage == null) myTextFrames[i].remove();
               // deletes empty Textframe
               else if (myTextFrames[i].contents == "") myTextFrames[i].remove();
          } // for
          myDocs[j].save() // Save the actual Document
          myDocs[j].close()     // close the actual Document
     } // for
} // main
Kind Regard
Dani (from Switzerland)

Similar Messages

  • Find a text frame on the page with script label

    hello to all
    I need to create a script to
    find a text frame on the page with script label "xxx"
    and read its contents into a variable.
    The content of the text frame is a number.
    thanks

    Hi Roberto,
    Welcome to the forum,
    This will find the labeled textFrame on the active page.
    var myLabel = "Foo", // change to label
          myPage = app.properties.activeWindow && app.activeWindow.activePage,
          myTextFrames = myPage.textFrames.everyItem().getElements().slice(0),
          l = myTextFrames.length,
          myVariable
    while (l--) {
        if (myTextFrames[l].label != myLabel) continue;
        myVariable = myTextFrames[l].contents;
        break; // presuming there's only one "Foo" labeled frame on the page
        // Otherwise you'll nead an array
    alert(myVariable)
    Trevor

  • Table of contents and the order of multiple text frames flowing across pages

    I have a multi-page document,
    on each page, there are 2 text frames:
    - A text frame for containing a PAGE TITLE
    and
    - A text frame, flowing from one page to another containing: a MAIN TITLE, a SECTION TITLE, and flowing body copy (on page 1); and another MAIN TITLE, a SECTION TITLE, and flowing body copy; (on page 2)
    When I generate a TOC, using the Page, Main and Section Titles styles, the expected outcome would be:
    Page Title             1
       Main Title           1
    Section Title          1
    Page Title             2
       Main Title           2
    Section Title          2
    But because the Main title and Section titles are all within one flowing text frame and the content flows across multiple pages, and each of the Page Titles are within 2 separate text frames, the actual TOC generated is:
    Page Title             1
       Main Title          1
    Section Title         1
       Main Title           2
    Section Title          2
    Page Title             2
    ...where the TOC lists all the TOC items from the flowing text frame in one grouping first, then the individual free standing text frame title.
    QUESTION: Is the only way to automatically rectify this is to combine all the text into one flowing text frame? or is there another workaround?
    Have played with the left/right, top/bottom alignment of the individual text frames; also experimented with the object layering, to no avail..
    Thanks for any insights.

    I ended up using a product called InFlow from EmSoftware.  The solution offers a plugin to InDesign that builds pages on the fly when there is overset text.  The setup is pretty minimual and it seems easy to use.  The only drawback that the plugin MAY have is that it does not remove the pages it built if the pages are not needed from record to record.  I could not test this myself since my test data did not test more then one record, but when I turned my proof set off, the pages that were built were still on screen.  It does seem to work well for what we are looking to do, so if anyone is looking for something that will build pages on the fly in situations where the "Dynamic Story Handling" is not available, I would suggest looking into this.

  • Deleting text frames without a specific fill color

    I was wondering if someone might be able to tell me a simple way in javascript to scan through all the text frame in my active document that are NOT filled with the following RGB values...
    fillColor.red = 11
    fillColor.green = 142
    fillColor.blue = 196
    Windows 7 64 bit, CS4

    I changed my concept to make it more dynamic for my purpose. I am checking to see if the fillColor typename is RGBColor or GrayColor. I am deleting anything that is GrayColor. Thought I would share the code for the community to use as you wish. Hope it helps somebody!
    var doc = app.activeDocument
    var allText = doc.textFrames;
    var readFillColor = [];
    for(i=0; i<allText.length; i++)
      textItemsRange = allText[i].textRange;
      readFillColor[i] = textItemsRange.characterAttributes.fillColor
      if(readFillColor[i].typename == "RGBColor")
      //alert("Found RGBColor")
    else{
      //alert("Found GrayColor")
      textItemsRange.remove();

  • Help w. Text Frames in Master Page

    Hi
    I need to make a simple task, yet it seems impossible.
    I am making a large number of documents of the same type and stlye. Lets say, something like a diploma or a certificate. They all have the same design, and the only thing that is different in them is the text in the 2 text boxes each one of them has. Lets say if we follow the certificate example that on each card I must put in the same two text boxes - "the name of the person" and "the date". So I must set a nice master page with 2 text boxes that I can fill in for each card. Since the design may change, I need to be able to move the positions of the boxes from the master page after I have filled them. I must also be able to change the case, font and other text properties of each box. For example, I when I would have done 1000 certificates and filled in respectively 1000 names and dates of receiving and then I would decide that I must place the box with the name on a different position on the page and also change the text properties, say from Times New Roman to Georgia. And to do it from the master page or any other effective way without changing each certificate.
    So far, I managed to place the boxes on the master page, and I saw that I can overwrite the text in each certificate and still be able to move the position of all boxes from the master page. But I cannot find a way to change the text properties of all boxes.
    Thank you for your help!

    cecozzy wrote:
    Hi
    I need to make a simple task, yet it seems impossible.
    I am making a large number of documents of the same type and stlye. Lets say, something like a diploma or a certificate. They all have the same design, and the only thing that is different in them is the text in the 2 text boxes each one of them has. Lets say if we follow the certificate example that on each card I must put in the same two text boxes - "the name of the person" and "the date". So I must set a nice master page with 2 text boxes that I can fill in for each card. Since the design may change, I need to be able to move the positions of the boxes from the master page after I have filled them. I must also be able to change the case, font and other text properties of each box. For example, I when I would have done 1000 certificates and filled in respectively 1000 names and dates of receiving and then I would decide that I must place the box with the name on a different position on the page and also change the text properties, say from Times New Roman to Georgia. And to do it from the master page or any other effective way without changing each certificate.
    So far, I managed to place the boxes on the master page, and I saw that I can overwrite the text in each certificate and still be able to move the position of all boxes from the master page. But I cannot find a way to change the text properties of all boxes.
    Thank you for your help!
    With a long list of data items, you could consider using data merge. You'd need a template document; on its page create a placeholder text frame for each data item, like name and date, if they'll need individual positioning. Put a data placeholder in each frame. (It's also possible to insert multiple merge placeholders in a single frame.) You'd also need paragraph styles. If you have material that is the same on every page, put that on a master page in the merge template.
    Search Google for terms like "InDesign data merge tutorial," and similar phrases, without quotes, for details.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • Problem with master page text frame

    I am using ID 4 on a Mac with Snow Leopard 10.6.6. I have created a master with facing pages and master text frame. But the pages based on that master do not have any text frames showing. When I go to Document Setup the Master Text Frame checkbox is ticked, but the tick and the words "Master Text Frame" are greyed out.
    I have deleted and reinstalled ID4 and  have renamed the InDesign Defaults and InDesing SavedData preference files but no improvement.
    I have to place or copy and paste quite a few pages and don't want to create text frames for every page.

    Do you mean CS2, version 4, or CS4, version 6? My guess is the former since that seems to behave exactly as you describe with the master frame option inaccessible after you've set up the file. In CS2 the master frame is there, but you don't see it on the document page if it is the same size as the margin guides because they obscure the frame edge. If the Ctrl (Cmd) + Shift + Click in the frame area you should see it become visible as it is overridden and selected.
    Aside from that, everything in the first two responses is dead on. If the master frame is the size of the margin guides, it's totally superfluous for normal work and more of a hindrence than a help.

  • Document Setup Primary Text Frame Greyed Out

    I need to set Primary Text Frame for my already existing document, but it is greyed out. What is needed for it to work?

    You must set Primary Text Frame on a master page. You can't already have content in the text frame.
    Try dragging out the frame you want on the Master Page. With the Frame Edges turned on, pause over that frame and you will see the tool tip shown below. Click on it and it will become a Primary Text Frame.
    By the way, you can only have one Primary Text Frame on a page.

  • Indesign CS3 text frame parameters and export PDF

    could use some help with the following:
    I need to edit and export a large number (7000) Indesign documents (one page)
    1. check for locked text frames and unlock
    2. group all text frames
    3. set grouped text frames at x=8 millimeters, y 10 milimeters
    4. export the documents to PDF in a subfolder called "Out"
    5. save and close the documents in the same subfolder as an Indesign CS3 document (orig is CS2)
    This is what I've been trying soo far:
    Now only checking one text frame - should be all text frames
    "close document 1 saving yes" doesn't work because the originals are from CS2
    I get a PDF called "Adobe Indesign SC3"
    set processFolder to choose folder with prompt "Choose a folder that contains Innd Docs to process"
    tell application "Finder"
    if not (exists folder "OUT" of processFolder) then
    make new folder at processFolder with properties {name:"OUT"}
    end if
    set the destination_folder to folder "OUT" of processFolder as alias
    end tell
    tell application "Finder"
    try
    set listFiles to (files of contents of processFolder) as alias list
    on error
    set listFiles to (files of contents of processFolder) as alias as list
    end try
    repeat with thisFile in listFiles
    tell application "Adobe InDesign CS3"
    with timeout of 120 seconds
    activate
    set properties of view preferences to {horizontal measurement units:millimeters, vertical measurement units:millimeters, ruler origin:page origin}
    open thisFile
    set myDoc to document 1
    set docName to name
    tell myDoc
    set transform reference point of layout window 1 to top left anchor
    set myBox to text frame 1 of page 1
    set properties of myBox to {locked:false}
    move myBox to {8, 10}
    end tell
    export document 1 format PDF type to (destination_folder as string) & docName & ".pdf" using PDF export preset "[Drukwerkkwaliteit]" without showing options
    close document 1 saving yes
    tell application "Finder" to move thisFile to destination_folder with replacing
    end timeout
    end tell
    end repeat
    end tell
    end
    end
    Any help is greatly appreciated - Doing this manually is a lot of work!!!!!
    Peter

    You're asking for the name of the application, not the document -- you need<br />to do it after your "tell myDoc".<br /><br />You could also get the name from the alias you open, rather than the open<br />document, something like:<br /><br />repeat with thisFile in listFiles<br />set oldDelims to AppleScript's text item delimiters<br />set AppleScript's text item delimiters to {":"}<br />set docName to text item -1 of (thisFile as Unicode text)<br />set AppleScript's text item delimiters to oldDelims<br /><br />You should also move your "set properties of view preferences" line to after<br />your "tell myDoc".<br /><br />-- <br />Shane Stanley <[email protected]>

  • In Design CS 6 crashing on resizing a text frame

    Some specifics:
    2 MACs networked via cable directly connecting the two.
    one MAC Pro 12GB RAM 10.6 OS
    one Imac 16GB RAM 10.8 OS (this replaced another MAC Pro that we were told had a bad RAM controller when we started experiencing this odd crashing)
    I have built a 10 page document that is part of a book. This document has been working fine until today. I saved the file yesterday and came back to it today to do some more work. Everything was going along as expected until I came to a particular text frame. Every time I try to resize or delete this text frame ID crashes. I've also noticed that if I add a text frame after (next page) the problematic text frame ID crashes. Recovery says it's recovering but the file crashes in the same way after the file is reopened. I can move all the other text frames around and do other things, but when I adjust that text frame ... crash.
    If I move the problem text frame off the page, onto the workspace I can do anything I want to the frame, but, if I move it back to the page where it came and adjust it ID crashes.
    This (mysterious corruption) has happened many times over the last year or two. Not always a text frame, deleting something, moving something, small things you wouldn't think would crash the app. I think the problems started with either 5 or 5.5 ... or possibly an OS update ... or both. We've used ID for five / six years now and this issue wasn't happening before 5 or 5.5.
    Exporting to IDML results in the same problem. (clarification: I can make the adjustments to the text frame in 5.5 to the IDML file. Saved back to an INDD file, open in 6, and the problem returns.)
    Resetting prefs doesn't change this behavior with the corrupt file.
    Problem file crashes ID on both computers.
    Thoughts? Questions?

    Is the 8.0.1 patch for ID installed?
    Have you tried Remove minor corruption by exporting?
    If that doesn't work (and I suspect it won't, but do try it), you mentioned you can move the frame to the pasteboard. Can you delete it from there? How about if you unlink it from the text thread (click the outport of the frame before it, then clikc inside that same frame to break the thread at that point). If you can delete the frame you should be able to add a new frame and relink if the frame iteslf is corrupt. If that doesn't work, try exporting the story to InDesign Tagged Text, then re-import it replacing what's there.

  • Multiple selected text frame to table

    I am looking for a script that will allow me to select multiple text frames at one time and have the contents in those text frames converted to tables.
    What I have to do now is place the cursor in one text frame, select all, select menu item "convert to table", the defalt dialog appears and I click ok.
    I have ten text frames on a page (for example). The manual process means I have to do the text to table 10 times per page.
    So, I would like a script that will allow me to select all 10 text frames and convert the content of each frame to a table.
    Any suggestions are appreciated.
    RPP

    This should do it:
    if (app.documents.length > 0 && app.selection.length > 0)
      for (i = 0; i < app.selection.length; i++)
        try {app.selection[i].texts[0].convertToTable ("\t", "\r")}
          catch (_) {}
    Peter

  • Can you connect differently tagged text frames?

    I have a one file document (no book) that I would like to have two columns on the first page and the Left/Right pages have one column with a side head. I would like the right column on the first page to flow into the second page.
    Is there a way to connect differently tagged text frames together so that, although their appearances are different, the text flows from one to the other?
    Thanks,
    Tim

    tkelly5446 wrote:
    I have a one file document (no book) that I would like to have two columns on the first page and the Left/Right pages have one column with a side head. I would like the right column on the first page to flow into the second page.
    Is there a way to connect differently tagged text frames together so that, although their appearances are different, the text flows from one to the other?
    Thanks,
    Tim
    You can manually connect text frames on body pages, or on master pages, that have the same flow tag. Search Google for "framemaker connect text frames" without quotes.
    For the text to flow automatically from one body-page text frame to a body-page text frame on another, and create new pages as needed, the text frames need to be on master pages, have the Autoconnect property turned on, and be in the same text flow. FrameMaker only applies Left and Right master pages (you get them if your document is set for facing page.) To apply custom master pages instead of Left and Right, you need to set up a mapping table on a reference page for use with the Apply Master Pages feature. Search Google for "framemaker apply master pages mapping table" without quotes.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • How to create a 'clone' linked text frame

    I have a large document, and the page numbering is not in a straight manner, as there are blank pages, which must be ignored for numbering. The blank pages are needed to make it easier for the printer, some pages need to be one-sided, others need to be two-sided.
    The numbering of the pages need to be done manually, or else I have to assign every page a section start, and for printing purposes this is kind of risky (page 1 is not really page 1 for instance...)
    OK, so far so good, I also need to create a table of contents, and check the document, and I was wondering if I could create a larger 'copy' of my manual page number, next to the page. At the moment I need to zoom in or select the frame and use apple-y to check the number.
    I create a slug area, I would like to put a larger textframe with the number in a larger corps in it, but it needs to 'link' to the original smaller text. Is this something that could be done by a utility or another way? It is not something I have to do every day, but I was just wondering if a kind of active 'clone' was possible. The 'copy' needs to be actively linked to the other textframe, every change must be implemented, but on a document page, not through a master page.
    Or else a page numbering scheme like 1,3,5,7 of 'ignore blank pages' would be appreciated

    That's a really bizarre way to number pages. Make sure you specify this to the printers, as a note to them. It's just not a normal way to number pages and printers would appreciate a heads up on it.
    There is no way to automate it as such. It would have to be manually updated when pages are added or moved around.
    You will still need two Master Pages
    Create an empty text frame on the Master Page on both spreads, make sure they are linked.
    Create a text file with sequential numbering from 1 - whatever the final page number is.  (excel can do this quite easily).
    Place the text file into the Main Pages at the starting page.
    You will then need to apply the Master Page without that text frame to every page that does not need a page number.
    You can do this easily by holding down Control (might be CMD on Mac) and then selecting the pages that don't require page numbers - then use the Apply Master Pages and select the master page to apply to those pages.

  • Mirror Text Frames

    For InDesign CS5. I have two text frames on different pages which will have mirror content. The text will be updated weekly. Is there a way to link these frames so that when I enter information into frame one, it populates in frame two?

    There are a few ways to fake it. I've seen discussion of exporting a selection for InCopy and placing that. Seems to be a pretty close workaround that will do what you want, although when I was playing around with it I had to refresh the target .icml frame. It may be possible to use this workaround in your case, I'm not sure.
    You might be able to use a cross reference - but then you couldn't do it by frame, as you requested. Once again, you'd have to click the "Update cross-references" button to update the target, it wouldn't happen automatically. You'd update the text in one area, and then update the cross-references to get it to propogate to the other location. This solution is kind of finicky.
    Sometimes, I have turned on "Create Links When Placing Text and Spreadsheet Files" in the File Handling section of the Preferences dialog, so I could have multiple frames all update more-or-less automatically from a source text file whenever I reopened the InDesign file. I like this solution for two reasons. First, I always get reminded to update links whenever I open an InDesign file, so I am always reminded to update the "target frame" unlike the cross-reference method. Second, all of my text content in ID is submitted to me by translators in easily linked text formats (like Word or RTF or raw text or et cetera) so I already am accustomed to managing linked text files.

  • Symlinking a text frame

    Hi,
    Is there any functionality like symlink concept in linux.
    Is there a way to create a link from text frame to page, i mean symlinking text frame to a page
    this way it will automatically reflects the page contents in to a trext frame.
    this is required for creating a web farma ?
    If there is any such functionality can u tell us ?

    Hi,
    Let me clearly explain u what i mean
    Consider there is a page of 1000 mm x 670mm
    It contains 16 frames each of size 145mmx223mm.
    My Indesign document also contains 16 pages each of size 145mmx223mm .
    So i am searching is there any way to link the text frame with the individual pages.
    This way whatever changes u make in those pages it will automatically updated in the text frame.
    This possible if the text frame can be linked to page

  • Some pages use master text frame, others don't. Fix?

    It turns out in my document, some of my pages have a master text frame and others don't. Many don't. It must be the way I created the frames, accidentally creating independent frames. Is there a fool proof way not to accieentally create independent frames and is there a good way to make sure all these pages with independent frames are turned back into master text frames?
    What I can do is delete the independent frame, then link the previous frame to the inside of the master text frame (I think I used to drop the link on a ruler too often and that creates an independent frame that is in most cases indistinguishable from a master text frame). This is tedious to do for the entire document. Is there an easier way?

    It sounds like you understand what happened. Clicking the place gun cusror on any type of guide will ignore your master frames. Overriding a master text frame before placing the text and Shift-clicking in the overridden frame will also ignore the master frames on subsequent pages.
    The bes thing you can do is keep your eyse open to watch the shape of the cursor. If ID is going to use an existing frame the cursor will be surrounded by parentheses and a new frame will use a cursor with a square upper left corner. You should also develop the habit of clicking in empty areas away from guides if you are using existing frames -- you don't need to click at the top of these frames.
    It's also possible that you did everything correctly and you are working in a facing pages file and at some point added or deleted a single page somewhere other than the end. That would cause all following pages to switch sides and master objects would be reapplied behind any overridden frames.
    There is no easy way to deal with extra frames. If they are not causing a problem you may be able to simply ignore them.

Maybe you are looking for

  • Error 4261 - burning problems

    Hello, I've been burning CDs with iTunes for years without any problem. As of about 2 weeks ago, I started receiving 4261 errors almost every time I attempt to burn a CD. At the advice of some similar posts, I have slowed down the burn speed to 1x am

  • Can I format an IDE Hard Drive from Mac Pro?

    I use a mid - 2012 Mac Pro; run Mavericks OS X 10.9.2. 1. Can an IDE hard drive (using an external drive) be formatted to 10.9.2, from my Mac Pro using Mavericks? (the IDE hard drive is new/unformatted). 2. Once formatted to 10.9.2, can I reformat th

  • Ripping Files From a Non Commercial DVD

    Is there an alternative to MPEG Streamclip for doing this? I love the little app but just wondered if there was anything else out there that does an equally or better job? Regards, Kenny.

  • Error in KE27 - run for trading goods

    Dear gurus! i have a error when i run KE27. Current, my customer don't have production activity. In SAP system, we activated Material Ledger. in period, i wanna run Periodic valuation (KE27) for all trading goods. (Note that we don't have finished go

  • Problems using the Spot Healing Brush

    I've tried to use the spot healing brush on a number of photos but it doesn't work at all - I've watched the video tutorial, but wehen I try and use it nothing happens - it appears to be the only part of Lightroom 5 that doesn't work. How can I solve