[JS] [CS5] My Script will not remove any cardboard in CS5

Hi all

We used this script in years, but CS4 now I try it in CS5 and it removes everything, not only the items on the pasteboard. I know there are a few changes with pageItems in CS5 and I suspect it has something to do with the problem, but I can't. Any help would be greatly appreciated as usual. Also, I took out cela a script that Dave Saunders created for us. I would use it in another script, that I am currently working. I know that's not pretty as if it were when Dave created, but I tested this in CS4 and it works, if you can clean at all too, would be great.

var myDoc = app.activeDocument;


deleteAllPasteboardItems(myDoc);

function deleteAllPasteboardItems(myDoc) {
          var myPIs = myDoc.pageItems.everyItem().getElements();
          for (var j = myPIs.length - 1; j >= 0; j--) {
               var page = findPage(myPIs[j]);
               if (page === null) {
                    // must be on Pasteboard -- can't be overset
                    try
                    {
                         myPIs[j].locked=false;
                         myPIs[j].remove();
                    }
                   catch (err)
                    {
                    }
               }
          }
     }




     function findPage(theObj) {
          if (theObj.hasOwnProperty("baseline")) {
               theObj = theObj.parentTextFrames[0];
          }
          while (theObj != null) {
               var whatIsIt = theObj.constructor;
               switch (whatIsIt) {
                    case Page : return theObj;
                    case Character : theObj = theObj.parentTextFrames[0]; break;
                    case Cell : theObj = theObj.insertionPoints[0].parentTextFrames[0]; break;
                    case Note : ; case Footnote : theObj = theObj.storyOffset; break;
                    case Application : return null;
               }
               if (theObj == null) return null;
               try
               {
                    theObj = theObj.parent;
               }
               catch (ignored)
               {
               }
          }
          return theObj
     } // end findPage

 

Thanks again,

Danny

Hey Danny,

In ID CS5 any top-level page point belongs to spread even if it is on a page, so your findPage function no longer works. Fortunately the DOM offers now a parentPage property that returns the null value if the object has no parent page (= does not hit any page).

The following excerpt should do the job:

// ===============================================
// Remove Pasteboard Items / InDesign CS5+
// ===============================================

removePasteboardItems(app.documents.length && app.activeDocument);

function removePasteboardItems(/*?Document*/doc)
{
    if( !doc ) return;

    var items = doc.pageItems.everyItem().getElements(),
        t = null;

    while( t=items.pop() ) t.parentPage || removeItem(t);

    t = items = null;
}

function removeItem(/*PageItem*/item)
{
    try {
        item.locked = false;
        item.remove();
        }
    catch(_){}
}

@+

Marc

Tags: InDesign

Similar Questions

  • How redir to C:\ TEMP > unwanted dir dir is empty but will not remove. I can't delete the dir eighter. Any ideas?

    How rmdir C:\ TEMP > unwanted dir dir is empty but will not remove. I can't delete the dir eighter. Any ideas?

    Hello Ssmith331,

    Welcome to the Microsoft Answers Community!

    Try adding a/s in front of the path of the directory you want to delete. For example: rmdir /s C:\Temp\Test

    For more information about the Rmdir command, follow the link below:

    RMDIR

    Hope that helps, I look forward to hearing from you.

    Steven
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think

  • Tecra M1 will not read any type of SD card

    Help!
    According to the title, my M1 will not read any type of SD card. I'm running the SP2 of XP reloaded from original floppies, and it is fully up-to-date with Windows Update.
    The little green light adjacent to the slot flashes briefly on the insertion of a card, but nothing happening for example no open option window and nothing visible in my computer.

    I downloaded the latest drivers and installed according to the directives of the readme.txt file and even thought to copy the SDDEVMGR.dll in the System32 folder.
    I obviously lack something, so any help or pointers are welcome.

    Thank you very much. Craig

    Hello

    Usually, books are not all sizes of SD card and so you should be sure that the used SD card is supported and compatible with the Tecra M1 card reader.

    But if you are using a compatible SD card the laptop should be able to read/write on the SD card.
    I try to remove the SD card in the Device Manager controller and remove the driver software malfunction. Restart the computer and install the latest drivers again.

    PS: A registry cleaning would be desirable. CCleaner is a great registry cleaning applications

  • Outlook Express 6 - recently emptied my folder deleted items, but now I can not remove any messages in my Inbox

    For my sins, I always use Outlook Express 6 for my e-mail personal. Recently, I've erased my deleted items folder, but now I can not remove any messages in my Inbox. Any ideas?

    Thank you

    Outlook Express has never reduced the file size of the file folder deleted during the clearance of the output folder. Instead he left a lot of dead space that has not been used for something beyond too much space.

    The good news is that if you simply, locate the Outlook Express mail storage folder and delete the Deleted.dbx file, Outlook Express will recreate a new vacuum the next time it starts up.

    1. Open Outlook Express and access Tools, Options of dialogue,Maintenance tab, click store folder and copy the location. Close Outlook Express.
    2. Click on Start, run or the Windows key + R to rap then paste in the location previously copied and press on . The storage folder should open.
    3. Remove or rename the Deleted.dbx file.
    4. Close the file, and then restart Outlook Express.

    That should solve your problems of deletion. You can also run a Compact on your other files .dbx tabmaintenance Tools, Options dialog box.

  • Outlook express 6 will not receive any e-mail, send e-mail

    Outlook express 6 will not receive any email from verizon but not email.  Tired separate identify and clear and redo account?

    An unknown error has occurred. Account: 'incoming.verizon.net', server: 'incoming.verizon.net', Protocol: POP3, Port: 110, secure (SSL): no, error number: 0x800C0133

    Now it means everything. Error number: 0x800C0133 = a corrupt Inbox.

    Move any message you want to save to a local folder that you create. Then, remove the problem of Inbox as follows.

    Tools | Options | Maintenance | Store folder will reveal the location of your Outlook Express files. Note the location and navigate on it in Explorer Windows or, copy and paste in start | Run.

    In Windows XP, Win2K & Win2K3 the OE user files (DBX and WAB) are by default marked as hidden. To view these files in Windows Explorer, you must enable Show hidden files and folders under start | Control Panel | Folder options | View.

    With OE closed, find the box of Inbox.dbx and delete it. Another will be created automatically when you open OE.

    General precautions for Outlook Express:

    Do not archive mail in the receipt or sent items box. Create your own user-defined folders and move messages you want to put in them. Empty the deleted items folder daily. Although the dbx files have a theoretical capacity of 2 GB, I recommend all a 300 MB max for less risk of corruption.

    After you're done, followed by compacting your folders manually while working * off * and do it often.

    Click Outlook Express at the top of the the folder tree so no folders are open. Then: File | Work offline (or double-click on work online in the status bar). File | Folder | Compact all folders. Don't touch anything until the compacting is completed.

    Disable analysis in your e-mail anti-virus program. It is a redundant layer of protection that devours the processors and causes a multitude of problems such as time-outs and account setting changes. Your up-to-date A / V program will continue to protect you sufficiently. For more information, see:
    http://www.oehelp.com/OETips.aspx#3

    Bruce Hagen
    MS - MVP October 1, 2004 ~ September 30, 2010
    Imperial Beach, CA

  • IPad will not allow any fly, so it does not open

    IPad will not allow any fly, so it does not open

    I have the same problem

  • Satellite A500-141 - the CD/DVD drive will not recognize any disk in the status bar

    I watch the DVD yesterday and he played upward halfway through and almost jerky. Ejected and thought no more of him now, the player will not recognize any disc, be it video or sound. I tried a system restore but still the same thing that it is not read disks. Any help appreciated.

    Thanks in advance.

    Hi quietly,

    If your CD/DVD drive doesn't work, how do you have a system restore?

    Is the CD/DVD drive listed in Device Manager correctly or you see a yellow exclamation mark on it?

    Maybe the lens is dirty and must be cleaned with a Microfiber cloth. Open try CD/DVD and try to clean the lens with a clean Microfiber cloth.
    Check this box!

  • Recently firefox will not access any web site Acer Aspire 1 Linux

    For the past few days firefox will not access any site, even if the wireless network is connected ok. NetBook runs ok other applications without any problem. When the browser shortcut is selected, shortened browser turns for a few seconds then stops. Nothing else happens.

    Can sometimes get the message 'cannot run the web browser by default. Input/Output error.

    I had the same problem (Acer Aspire One LINUX). RELOADED FireFox by following the instructions here:

    http://macles.blogspot.com/2008/07/installing-Firefox-3-on-Acer-Aspire-one.html

    Worked a treat.

  • T520 will not use any device DVD

    People,

    I was going to do a backup, when I noticed that the DVD player was no longer under my computer.

    I when in Device Manager, where he showed with a yellow X... I tried to update the device driver, it said that I had the right device. I've done many other things - nothing has worked.

    I really wanted to get the backup made, so I took my portable DVD player/burner and plugged. The laptop computer found a loaded device OK... but it does not appear in my computer. I had the same problem as the DVD drive internal.

    Then I got a USB drive external Passport, connected to the same USB port, no problems... He mounted the disk and I made the backup.

    My T520 will not use any device DVD... ideas?

    -Fred

    I did a quick search and voila. See the Windows 7 box.

    http://support.Microsoft.com/kb/314060

  • My HP Photosmart C4100Series printer will not remove a previously requested printing package, and is now stop printing of other things. How to rectify it please?

    I was printing a document from page 52, and then discovered that I was not necessary. After printing, the printer will not remove the print request, therefore it prevents me to print other documents. How can I correct this?
    I turned off the printer, but nothing helped.

    Thank you for your help. Very useful, but I had already found the doctor of scan HP printer on the internet and it was so simple to use and also corrected the fault in a few seconds.

    However, once more, I thank very you much.

  • My XP computer will not open any program or website without asking "open with", tried restoring the system

    Split of: http://answers.microsoft.com/en-us/windows/forum/windows_xp-security/my-computer-will-not-open-any-program-or-website/420df6df-8cf3-48e6-810b-a00c3fd04c69

    I have the same problem and when I click on system restore I am invited again to choose a program to open it with... now what?

    I have the same problem and when I click on system restore I am invited again to choose a program to open it with... now what?

    the windows system restore feature is a very important system.

    and if it is defective or failed in some way, then this may be a sign that your whole system could be damaged or unstable.

    what you can try is execution of the system via safe mode restore.

    If this does not work yet, so the next step is to move your personal files, documents, photos and send boxes out of the system because the following methods that will help restore your system can put your personal files safe.

    so after trying safe mode stage and or copy your personal files from the system, we can take the next steps.

    Incidentally, if your computer came pre-installed with windows, or you halographic disc of microsoft for the operating system?

  • Downloaded Driver Detective, how to uninstall? Uninstall will not remove this program. __

    Downloaded Driver Detective, how to uninstall?  Uninstall will not remove this program.

    Hello

    You may have to reinstall - it does not matter if it works.

    Then use Revo to uninstall:

    Revo Uninstaller
    http://www.revouninstaller.com/

    I hope this helps.
    Rob - bicycle - Mark Twain said it is good.

  • How to locate a file that is displayed on my desk to remove it at a command prompt indicates that this file "is no longer in C:\Users\owner\desktop. It is in plain site, but will not remove.

    How can I delete a file that sits on my desk and then will not delete but a prompt indicates that this file "is no longer in C:\Users\owner\desktop. It is in plain site, but will not remove.

    Hi SMingalone

     

    We can perform the disk cleanup and disk defragmentation to remove extra files on the hard drive. Refer to the below help links -.

    http://Windows.Microsoft.com/en-us/Windows7/delete-files-using-disk-cleanup

    http://Windows.Microsoft.com/en-us/Windows7/what-is-disk-defragmentation

    http://Windows.Microsoft.com/en-us/Windows7/improve-performance-by-defragmenting-your-hard-disk

     

    You can also check the below link for more assistance and control.

    http://Windows.Microsoft.com/en-us/Windows7/strategies-for-freeing-disk-space

     

    I hope this helps.

  • A real player files will not remove!

    Hey,.

    I downloaded a video and when I try to delelte, he goes to regular recycling window but it used to delelte, it is said of recycling for a long time and will not remove it, it cannot be moved, is doing the same thing... How can I get rid of this video!

    Thank you

    Jare4evr

    Windows Explorer does not always detect if a file is deleted outside of it
    (he tries too). Press F5 in the folder.
     
    Try this program
    http://ccollomb.free.fr/Unlocker/
     
    If the name (maximum 256 characters) and the path (max 260 characters) of the file is greater
    that 260 use this command syntax (note the--------?------added at the beginning of the)
    path that disables controls legal filename).
     
    del "\\?\c:\some.ext".
     
    --
    ..
    --
    "Jare4evr" wrote in message news: 95e24f24-ca68-4f67-8968-181c11a0f84d...
    > I did it and it did nothing in addition to move to the next line down, don't
    > error, but the file did not go either
     
     
  • Optiarc cd - rw crx880a ata device will not recognize any cd

    I have an acer laptop. It is an Optiarc cd - rw crx880a ata device. It will not recognize any cd / dvd... He appears with insert the cd. I open and close the cd drawer and always the same pop-up.

    My operating system is windows vista.

    Then you know that the drive is bad. You will need to buy a compatible optical drive, Acer or an after-market reputable dealer. Since it is a laptop, you can buy the disc just for her. Yes, it's probably easy to replace. Refer to the manual of your computer or search for a manual on the Acer tech support site. MS - MVP - Elephant Boy computers - don't panic!

Maybe you are looking for

  • Frustrated with Apple music early jump to the next song.

    Does anyone have a solution to keep the Apple music to jump to the next song before the end of the song that is currently playing? My iOS is updated and I play it back via SONOS on a home network routed through the latest AirPort Extreme wireless. I'

  • My cursor jumps all over the screen while typing.

    Original title: TYPING PROBLEM MY CURSOR JUMPS AROUND WHEN I TAPE. I DID A SCAN BUT NO HELP.

  • HP G62-355dx processor replacement?

    Hello I have a HP G62-355dx with windows 7, 64-bit and an AMD Athlon II Dual - Core P340 processor!, I would like to know if one can replace the processor with an AMD Turion 64 x 2 Dual - core T-60 processor 2 GHz? Thank you very much!!

  • NonPersistableObjectException on commit () [code]

    I use the following data record to store relevant data as a persistent object: [code] Import packagesNet.rim.device.api.util import. *;Import Java.util; / public class SentBM_Data implements Persistable{Private members  Public memberspublic int ID;pu

  • Update blackBerry Smartphones Blackberry Torch problems

    I have problems updating my Blackberry Torch with Blackberry Desktop Software for my Mac. I used to be seen Blackberry "BOLD" and backup of my files.  After I sold my "BOLD" and bought a flashlight, I restore data using the backup of the data of my p