How to copy/paste anchor text box to its anchor point in text and delete all empty anchors?

hi all
i have a document of few pages but one story. The right column is the main text box and on many places anchored text boxes are placed which appeared on the left column as shown below.
i want text of each anchor-text-box to be cut from its place and paste at its insertion/anchor point and delete all empty anchored boxes.
I am trying since morning but i unable to reach anchor object reference. Any help on how to start with will be helpful.
virender

Ok, let's say you have one main text box (not anchored) and three text boxes that are anchored to text within it. The first one is anchored with text, the second one is unanchored, and the third one is empty (I'm not going to get into inline anchoring vs. custom anchoring since you didn't bring it up in your post).
We cycle through the items on the page:
function main(){
  var myDoc = app.activeDocument;
  var myPages = myDoc.pages.everyItem().getElements();
  for (var i = 0; i < myPages.length; i++){
    var myPage = myPages[i];
    //Checks that the page is valid, and that it is not a master page. If either is true, skips to the next page.
    if (myPage.isValid == false) continue;
    if (myPage.parent instanceof MasterSpread) continue;
    var myItems = myPage.allPageItems;
    for (var j = 0; j < myItems.length; j++){
      //Current item.
      var myItem = myItems[j];
      //If myItem doesn't have a Character parent, it is not anchored.
      //The first and third text frames would fail this test.
      if (!(myItem.parent instanceof Character)) continue;
      //We only care about text frames.
      if (!(myItem instanceof TextFrame)) continue;
      //I think the only way this would happen would be if you had an image or
      //something else unexpected within the frame. I check for it so no content
      //is inadvertently lost.
      else if (myItem.texts.length > 1) continue;
      //If we're still in this iteration of the loop, all qualifications are met.
      //Flatten the text frame.
      //I don't use layers that often so, to me, flatten makes sense. You may want
      //to use a different term if there's a chance for confusion.
      flattenItem(myItem);
function flattenItem(funcItem)
     //Hold onto the anchor character.
    var myParent = funcItem.parent;
     //Duplicate the text from within the frame so that it appears right after the anchor.
     //There may be other methods, but this works for me. I try to avoid copy/paste
     //so as not to deal with any clipboard mishaps. I added a check in case of empties.
     if (funcItem.texts.length > 0){funcItem.texts[0].duplicate(LocationOptions.AFTER, myParent.insertionPoints[0]);}
     //Replace the anchor character itself with a space (or whatever) which also
     //deletes the text frame it was anchoring.
    myParent.contents = " ";
I guess the takeaway might be that you're not looking at the main text frame and then checking to see if anything is anchored to it. You're looking at each text frame and figuring out if it is anchored. That's my approach, anyway.

Similar Messages

  • How do i add media to my iphone from another computer without syncing and deleting all the info currently on it

    My iphone was synced to my old computer
    How do i add content to my phone from my new computer. It says i can only be synced with one computer and it will delete everything on my phone to sync with the new computer.
    This doesn't make much sense. What am i missing?

    It does make sense.  The iPhone is a one-person device and just syncs to one computer.
    The way it should work is as follows:
    Old computer content ---> New computer
    New computer <---> syncs to iPhone
    But the way you are trying to operate sounds like:
    Old computer content ---> iPhone
    ... and ...
    New computer content <---> iPhone
    So simply move your old stuff (either directly from iTunes, or from a computer backup) to the new computer, have it all there, then sync your iPhone to the new machine.

  • How to copy paste a new page with thumbnails view in Pages 5?

    How to copy paste a new page with thumbnails view in Pages 5?

    Feature removed along with over 90 others:
    http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=22&sid=b14426a2c5af2 65f2213d98ee45f08d7&mforum=iworktipsntrick
    Pages '09 should still be in your Applications/iWork folder.
    Export your Pages 5 files to Pages '09 or Word .docx and trash/archive Pages 5.
    Then rate/review Pages 5 in the App Store.
    Peter

  • How to increase the size of text boxes in FCPX without stretching the text inside?

    How to increase the size of text boxes in FCPX without stretching the text inside?

    There are two basic Title formats — I should say Layouts — available:  Text (plain) and Paragraph.  (The plain text version usually does not appear with the blue dot controls — those generally appear for the paragraph type control.)
    If the Title is using a Paragraph layout, it's like having a mini version of Text Edit available inside FCPX. You can tell when you click on the text (when the title is selected) -- a rectangle will appear around the text like so:
    double clicking on the text will give you the bounds controls which you can use to redefine the text area without distorting the text. Once selected, notice the button that appears in the top right corner of the canvas:
    Pressing that will activate the ruler. You can right click on the ruler and add Tab Stops (left, right, center and decimal.)
    So if the title uses paragraph formatting, you can create a very WYSIWYG type of display text (use the Text inspector to alter text selections within the paragraph bounds.)

  • How do i make a transparent box to place around some existing text?

    How do i make a transparent box to place around some existing text?

    Where? When? What? Sorry, you have not told us anything about your system or what program you mean nor any other details, so nobody can know anything. Ask in the forum for whatever program you are referring to.
    Mylenium

  • After placing a new text box in my document, typing new text, clicking away, then coming back to edit the text, I am unable to get my cursor to reappear within that text box. I can only select the box itself. I cannot select the text. Where is my cursor?

    After placing a new text box in my document, typing new text, clicking away, then coming back to edit the text, I am unable to get my cursor to reappear within that text box. I can only select the box itself. I cannot select the text. Where is my cursor?

    Even simpler than that.
    Clicking once in a text box selects it.
    Clicking once in a selected text box places the insertion point in the box.
    The clicks do not need to be close enough in time to be read as a double click.
    The same behaviour applies to table cells in Pages and in Numbers.
    Regards,
    Barry

  • Looking to create editable PDF forms with drop downs and text boxes for use on a Mac computer and iPad. Which product do I need to purchase? Do not need anything fancy

    Looking to create editable PDF forms with drop downs and text boxes for use on a Mac computer and iPad. Which product do I need to purchase? Do not need anything fancy

    Basically you would need Acrobat. However, it is now also possible to create basic form fields using just the free Reader. In fact, I've been working on a tool that allows you to do it, so if you're interested in it please contact me privately.

  • Top of text box moves up when typing new text exceeds box width.

    Using iWork 09 I set a text box on a master and mark it as Format/Advanced/Define as text placeholder. In the Text Inspector, I set parameters as left justified, align text to bottom, line spacing = 1, and other numerical parameters to 0. Then, on a new slide using this master, the top of the text box moves up to accommodate additional text and it would be seem more natural for the bottom of the box to extend DOWN instead.  What am I missig here?

    it would be seem more natural for the bottom of the box to extend DOWN instead.  What am I missig here?
    No it wouldnt. If you understand that, align to bottom, fixes the last character in the bottom line to the bottom right hand corner of the text box, the text then flows from that corner as you add extra text.
    You cant have align to bottom and have the text flow from the top, you need to choose between the three options.
    If you want to add extra lines without the box moving; use align to top.
    If you want to align the text to the bottom of the box; use align to bottom.
    I set parameters as left justified,
    There is no such thing as left justified.   You need to choose between justified or left align, these are two different alignment methods, text is either left aligned, right aligned or justified, not a combination of them.

  • How do I switch my 6th generation over to my new iTunes account and put all my songs from my iPhone onto it?

    How do I switch my 6th generation over to my new iTunes account and put all my songs from my iPhone onto it?

    The iphone is not a backup/storage device.  The sync is one way - computer to iphone.  The exception is itunes purchases. File>Devices>Transfer Purchases
    It has always been very basic to always maintain a abckup copy of your computer.  Use your backup copy to put everything back.

  • Will someone tell me what happen to my play list and how I can restore or get it back!  Apparently, apple for the second time to screw up and delete all my music again!!!

    Will some explain why apple for the second time manage to screw up and delete "all my play lists and music again"!   How can I restore it or get my music back...  If I can't get my music back the way it was the last time I used itunes I will sale both my ipod touches!!!

    Just what were you doing when it happened?
    Just sync it from your iTunes library.
    You can redownload iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • There are text messages that I'm having trouble deleting.  With some of my text messages, I can swipe to the left and delete ... or press and hold, get more and delete to trash can icon. But there are some where neither will work. Can't delete. Help!

    There are text messages that I'm having trouble deleting.  With some of my text messages, I can swipe to the left and delete ... or press and hold, get more and delete to trash can icon. But there are some where neither will work. Can't delete. Help!

    But once again, I do not want to lose my other texts, app progress, and photos. I could sync the photos but i would still lose the app progress and texts. I would only restore if it was the only option left, but the other space, as already stated, isnt the main concern. The main concern is those 'deleted' texts. If they go, then a good size chunk of the other space goes. I know you CAN delete texts for good. It worked fine before. All i want to know is why its not working for me now, and how to fix it.
    I also know that when you delete texts on your iphone, they get marked for deletion, however they stay on your device (thats why they show up when you search for them.) then when you sync your device with itunes, the texts marked for deletion should disappear. When i synced they didnt disappear. Thats what i need an explanation/solution for. Why the texts marked for deletion didnt get fully deleted after the sync.

  • When I try to print sth I can´t choose my printer. Adobe Reader only shows a printer I used years ago.I aleady deleted and reinstalled the Reader and deleted all other printers from the computer.How can I add a new printer to Adobe Reader?Thanks for help!

    When I try to print sth I can´t choose my printer. Adobe Reader only shows a printer I used years ago.I aleady deleted and reinstalled the Reader and deleted all other printers from the computer.How can I add a new printer to Adobe Reader?Thanks for help!

    Hi,
    I would suggest you to uninstall Adobe Reader using the cleaner tool and then re-install the latest version.
    Adobe Cleaner Tool:- Download Adobe Reader and Acrobat Cleaner Tool - Adobe Labs.
    Latest version of Adobe Reader:- http://get.adobe.com/reader/
    If you still experience the same issue, please share the following information:-
    - Screenshot of Adobe Reader showing printer options
    - Screenshot of Microsoft Word showing printer options
    - Screenshot of control panel- Control Panel\All Control Panel Items\Devices and Printers
    Regards,
    Nakul 

  • If someone steals my iPhone and deletes all pictures, that will sync to my Mac. So then all my photos are lost! How do I safeguard against this?j

    If someone steals my iPhone and deletes all pictures, that will sync to my Mac. So then all my photos are lost! How do I safeguard against this?

    If your phone (plus syncing) is the only place you keep your pictures you are asking for trouble, theft or not. Back up onto an external hard disk which is only mounted when you need it, then nothing external can erase them. Then make use of Apple's facilities for protecting your phone:
    If your iPhone, iPad, or iPod touch is lost or stolen - Apple Support
    iCloud: Use Lost Mode
    iCloud: Find My iPhone overview
    Find My iPhone Activation Lock - Apple Support

  • How do I return a MacBook Pro to Factory Settings and Delete all Passwords before I sell the Computer?

    How do I return a MacBook Pro to Factory Setting and Delete all Passwords and Files before I sell the Computer?

    How old is your Mac?
    What version of OS X came on it originally?
    You must return it to the version of OS X that came on it originally before you sell it.

  • How do I delete all empty graphics frames from a document?

    I have data merged a document and need to remove all the empty graphics frames as quick as possible.
    I have found solutions for deleting empty text frames but not graphics frames. Can somebody help with this as it will save soo much time and RSI!
    I found an applescript solution here:
    http://forums.adobe.com/thread/756281
    However, I am running Windows 7 and Id CC
    Cheers,
    Kris.

    Hi MToys
    I added a little to the script so that it will work on Ovals and Polygons also. [Not TextFrames]
    You just have to set the values for which of the frame types you want to delete.
    You can do this by setting the const values at the top of the script for DeleteRectangle, DeleteOvals, DeletePolygons
    There are a few uncertainties that I had:
    If an object is selected, should the script only delete that objects frame type.
    I.e., If you select an oval, should the script know to delete only ovals.
    At this point, I did not do that, rather it will just get the settings from the selected object, and delete all frame types with those settings
    I had to disable matching the transparency settings because they werent comparing correctly between different frame types
    Meaning, I made 3 frames, Oval, Rectangle and Polygon - no settings applied.
    I selected the oval and ran the script. It only deleted the oval even though set it to delete all.
    I found that the transparency settings werent matching... even though there werent any
    So, for now - its disabled.
    If someone can shed some light on this I would appreciate it.
    I tested the script on Mac Mountain Lion - ID CS6 and seems to work well
    Here is the script
    const Object_Style = false,
        Fill_Color = true,
        Fill_Tint = true,
        Fill_Transparency_Settings = true,
        Item_Layer = true,
        Stroke_Color = true,
        Stroke_Weight = true,
        Stroke_Type = true,
        Stroke_Transparency_Settings = true,
        Stroke_Tint = true,
        Stroke_Alignment = true;
    const DeleteRectangles = true,
        DeleteOvals = true,
        DeletePolygons = true;
    app.doScript(main, undefined , undefined, UndoModes.fastEntireScript, "INSERT_HERE_THE_SCRIPT_NAME")
    function main() {
        var myDoc = app.activeDocument;
        var mySel = app.selection;
        if (mySel.length > 0) {
            mySample = app.selection[0];
            if (mySample.constructor.name == "Rectangle" ||
                mySample.constructor.name == "Oval" ||
                mySample.constructor.name == "Polygon")
                var isSample = true;
                var objSty, fClr, fTint, fTrans, lay, sClr, sWeight, sType, sTrans, sTint, sAlign;
                GetProps(mySample);
        if (DeleteRectangles) {DeleteItems(myDoc.rectangles)}
        if (DeleteOvals) {DeleteItems(myDoc.ovals)}
        if (DeletePolygons) {DeleteItems(myDoc.polygons)}
        function DeleteItems(myGraphicFrames) {
            for (var i = myGraphicFrames.length-1; i >= 0; i--) {
                if (myGraphicFrames[i].graphics.length < 1) {
                    myGraphicFrames[i].select();
                    if (isSample) if (!checkProps(myGraphicFrames[i])) continue;
                    myGraphicFrames[i].remove();
        // ======================================
        function GetProps(mySample) {
            objSty = mySample.appliedObjectStyle;
            fClr = mySample.fillColor;
            fTint = mySample.fillTint;
            fTrans = mySample.fillTransparencySettings;
            lay = mySample.itemLayer.name;
            sClr = mySample.strokeColor;
            sWeight = mySample.strokeWeight;
            sType = mySample.strokeType;
            sTrans = mySample.strokeTransparencySettings;
            sTint = mySample.strokeTint;
            sAlign = mySample.strokeAlignment;   
        // ======================================
        function checkProps(myFrame) {
            var i=0;
            if (Object_Style) if (myFrame.appliedObjectStyle != objSty) return false;
            if (Fill_Color) if (myFrame.fillColor != fClr) return false;
            if (Fill_Tint) if (myFrame.fillTint != fTint) return false;
            if (Item_Layer) if (myFrame.itemLayer.name != lay) return false;
            if (Stroke_Color) if (myFrame.strokeColor != sClr) return false;
            if (Stroke_Weight) if (myFrame.strokeWeight != sWeight) return false;
            if (Stroke_Type) if (myFrame.strokeType != sType) return false;
            if (Stroke_Tint) if (myFrame.strokeTint != sTint) return false;
            if (Stroke_Alignment) if (myFrame.strokeAlignment != sAlign) return false;
            //if (Stroke_Transparency_Settings) if (myFrame.strokeTransparencySettings != sTrans) return false;
            //if (Fill_Transparency_Settings) if (myFrame.fillTransparencySettings != fTrans) return false;
            return true;

Maybe you are looking for

  • CRM 7.0 EHP3 Installation Export CD problem

    Dear all, we are installing SAP CRM 7.0 EHP3 on MSSQL 2012. We do encounter a problem with the installation Export CD. SWPM is SWPM10SP05_2-20009707.SAR - SP5 PL 2, Kernel is 741 (Material Number: 51048107_8). Installation Export Material Number are

  • ITunes 9 can no longer encode '24bit 96khz wav' to 'iTunes plus aac'

    In iTunes 8.2.1, on a G5 PPC running Leopard, if I try to convert a '24bit 96khz wav' file to 'iTunes plus aac' via iTunes, everything works fine. However, I cannot convert this same file using iTunes 9. It gives me an error saying something like 'fi

  • Why won't iTune 11 run on Windows 7 64-bit???

    Starting 3 ior 4 weeks ago -ever since updating to iTunes 11, I have been unable to start iTunes. I have tried every suggestion in the support community posting  (and a few that were not here) all to no avail. This involved many uninstalls (including

  • When I attempt to sign in, I get 'server error, please email'. Who do I email?

    1. HP Deskjet 3050 J611 2. Windows 7 3. SERVER ERROR         Oops!  Something just went wrong with our server.            Try refreshing the page. If you see this error more than once, email 4. New printer When I try to sign in to register my printer

  • The program can't start because MSVCR80.dll is missing

    When I brought up my laptop I was prompted to update i-tunes. The download went bad for whatever reason and now I can not access i-tunes. If I click on the icon I get this error message "The program can't start because MSVCR80.dll is missing from you