Can't remove all Rectangles

Hi,
the code below should
1) open a INDD file
2) traverse all pages
3) grab all the rectangles from that page
4) and delete them.
things that work:
the script traverses trough all the pages (4 pages)
he finds all the rectangles on that page
but then:
when there are for example 5 items on that page, he shows me in that there are 5 items on that page, but when he goes in the second while loop, he only does it 3 times, when he actually should loop 5 times... that's so strange.
Result: a indd file with only a few rectangles removed, and some remain...
So, if someone could help me/show me, that would be awesome!
Thanks !
Tha code!
destination =  app.open(File("/Users/anders/Desktop/46a93e71-b6bc-477f-abfd-3221f527dc44/VerticalDMA5.in dd"));
destination.documentPreferences.facingPages = false;
var pages = destination.pages;
var page;
var pageItems;
var v = 0;
var z = 0;
$.writeln ("pages = " + pages.length)
while(z < pages.length) {
    page = pages[z];
    pageItems = page.rectangles;
    $.writeln ("number of items on page = " + pageItems.count())
    while(v < pageItems.length) {
        pageItem = pageItems[v];
        $.writeln("PageItem: "+pageItem+" ID: "+pageItem.id);
        pageItem.remove();
        v = v + 1;
    v = 0;
    z = z + 1;

Hi,
I'm a C++ programmer not a scripter, but the bug is obvious:
Jou have a list/arry of page items and remove from first to last index incrementing with each iteration.
This will delete item[0] and increment to list/array index 1, holding the third page item, as you just deleted the first.
So do a while ( list.length ) delete item[0] or alike.
Best,
Peter Schülke

Similar Messages

  • How can i remove all PC authorizations from iTunes account?

    How can i remove all PC authorizations from iTunes account?

    Removing a credit card from an account - iTunes Store: Changing Account Information - http://support.apple.com/kb/HT1918 - More information at: https://discussions.apple.com/message/15891166

  • HT4314 someone is using my account on clash of clans, can you remove all the device that are cnnected to my apple id? so i will be the one who can use it because iam the only one who knows my password. please help me guys i need my clash of clans

    Hi im allen. My problem is someone is using my account on Clash of Clans. Can you remove all device that at connected to my apple id? Will I be the only one who can access my game center and apple id thanks a lot apple team!
    <Email Edited By Host>

    Apple is not here.
    There are only users here like yourself.
    We can do nothing at all about any devices on you AppleID.

  • How can I remove all photos from my iphone?

    How can I remove all photos from my iphone?

    Hi pjdemeo,
    I understand you want to delete all of the photos from your iPhone.  As a precaution, I would suggest importing the photos and videos from your iPhone into your computer.  This will give you a backup for the images, and after import you will be asked if you want to delete the photos.
    Import photos and videos from your iPhone, iPad, or iPod touch to your Mac or Windows PC - Apple Support
    https://support.apple.com/en-us/HT201302
    The iPhone User Guide has instructions for deleting photos directly from the device:
    Organize photos and videos - iPhone
    http://help.apple.com/iphone/8/#/iphf14943e
    Delete a photo or video from Photos. Tap the Photos tab, tap the photo or video, tap , then tap Delete Photo or Delete Video. Deleted photos and videos are kept in the Recently Deleted album on iPhone, with a badge showing the remaining days until the item is permanently removed from iPhone. To delete the photo or video permanently before the days expire, tap the item, tap Delete, then tap Delete Photo or Delete Video. If you use iCloud Photo Library beta, deleted photos and videos are permanently removed from all iOS 8.1 devices that use iCloud Photo Library beta with the same Apple ID.
    Cheers,
    - Judy

  • How can I remove all my preferences and settings from mail and do a clean install of mail app?

    How can I remove all my preferences and settings from mail and do a clean install of mail app?

    Open mail > Preferences > Accounts
    Select the account and click the minus button at the bottom of the column.
    Quit mail
    ~/Library/Preferences/com.apple.mail.plist move this file to the trash and empty it.
    ~/Library/Mail/ and move all of the items in that folder to the trash and then empty it.

  • How can I remove all photos and directories from iPhoto?

    How can I remove all photos and directories from iPhoto as if it was a brand new install?
    I am new to iPhoto and was unaware of how it works, honestly I still am a little confused as to when pics I am using 1/2 the time, some from iPhoto and some from MyPics.
    Anyhow, I am looking to remove all photos from iPhoto because during the migration of all my photos from PC to MAC, somehow my timeline became messed up and all my photos that have been logged my dates since 1998 are now all messed up.
    Although all my year folders are still in tact, IE 1998-2006, the subfolders and like pics are all intertwined somehow.
    And when I search iPhoto for a given year, photos from 2,4, 8 yrs back show up in 2006.
    Anyhow, I have selected and deleted all photos and folders within iPhoto, and then import the desired photos from MyPics, only to have the photos double up in the library. ( The old ones that should be deleted and the new imports)
    I simply don't get it, they fill the trash and disappear when it's emptied, then reappear when iPhoto re-opens!
    Can someone help????
    I have completely reworked all my photos so that they are all in the correct folders outside of iPhoto, and now I want to import those and only those pics with that file structure.
    IE Structure = YEAR > MONTH > DAY ( or if needed) > DAY/EVENT

    Do you want to remove the existing full sized image files also? If so then just drag the iPhoto Library folder from the Pictures folder to the Trash and empty it. But be warned you'll lose all of your image files.
    You are dragging the files to the iPhoto Trash bin and then using the iPhoto->Empty Trash menu, right?
    In copying your photos to myspace and then back the original capture date may not be retained and then either the created date or modified date will be used by iPhoto. If the files in the current library are the originals from your camera then those have the best chance of retaining the correct Captured Date. You can check that out by dragging the Originals folder from your iPhoto Library folder to the desktop and then trash what remains of the iPhoto Library folder. Then launch iPhoto and it will ask you to create an new library. Then import that Originals folder and it's subfolders by dragging it into iPhoto's open window. You'll keep the same rolls that was. The roll dates may change but you can check the captured date of the files by using the calendar in the Source pane.
    You won't be able to keep your folder structure within iPhoto. Each outside folder will result in a roll with the same title as the folder. You'll be able to create folders in the Source pane to put albums inside. You can create a smart album to include all photos in a certain date range, line one month.
    Do you Twango?
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    G5 Dual Core 2GHz, 2G RAM, 250G HD; G4 Dual 1Ghz, 1.5G RAM, 80G HD,   Mac OS X (10.4.7)   22 LCD Display, 200G & 160G FW HDs, Canon S400, i850 & LIDE 50, Epson R200

  • How can I remove all returns within the text?

    I copied and pasted text onto pages from the internet, but the text does not go all the way to the end of the set margins that i have on Pages, instead it goes about halfway or so and begins on a new line. how can i remove all of the spaces between the words so that it runs the full length of the page.
    It blows my mind that i have to resort to seeking help on the apple forums for this problem, it seems like something so simple would be a standard feature when adjusting text on the page. The only thing that could frustrate me more is if it impossible to do on this software, or if it is simple to do and I was too stupid to figure it out. If it is impossible then I'm **** out of luck because the document is just to **** long to sit there for hours and manually delete every single last return.

    Not to preempt your fun of playing with AppleScript, but here's my take on it:
    tell application "Pages"
        tell document 1
            -- Make sure there's no selection
            select insertion point before character 1
            set cc to count characters of body text
            set returnOffsets to (character offset of every character where it is return)
            -- Reverse order, since deletion would alter all subsequent offsets
            repeat with n in reverse of returnOffsets
                if (n > 1) then
                    if n < cc and character (n + 1) is return then
                        -- Treat double returns as a true paragraph break.
                        -- Delete the extra.
                        delete character n
                    else if character (n - 1) ≠ return then
                        -- Change single returns into spaces.
                        set character n to " "
                    end if
                end if
            end repeat
        end tell
    end tell

  • How can i remove all contact at once from ovi?

    after synchronise with ovi & my mobile how can i remove all contact from my ovi's contact.
    I can remove one by one but i want to remove all at once. how possible??
    Solved!
    Go to Solution.

    @tkwcare:
    Beware of that method. Restoring your contacts after sync'ing will restore the phone to a state with a timestamp prior to when the sync occurred. Sync'ing again will attempt to bring the phone up to date with the online resource and, in doing so, will delete all the contacts off the phone!
    Was this post helpful? If so, please click on the white "Kudos!" star below. Thank you!

  • 5.0 and 6.0 became entngle, and neithr will start. How can I remove all traces of Firefox and do a "clean" reinstall? Mozilla dosn't appear in Add/Remove Programs, and the uninstaller must've left something behind...

    I tried deleting the Firefox folder as well, but after reinstalling Firefox 6.0, I continue to get a Run error message saying essentially that 5.0 & 6.0 aren't compatible. So, how can I remove all versions from all locations and start fresh?

    I tried deleting the Firefox folder as well, but after reinstalling Firefox 6.0, I continue to get a Run error message saying essentially that 5.0 & 6.0 aren't compatible. So, how can I remove all versions from all locations and start fresh?

  • TS4062 How can I remove ALL MAIL from my message service to stops having to remove  1000's of messages by going to edit and removing individually

    Can I remove all mail messages without doing all individually

    THis is a reply to my own question, so that I can upload the Print Screen image of my browser toolbar. Look for "Hello World!" at the top, just above my address bar. Thanks again to anyone who can help me remove this from my menu bar.

  • HT5557 how can you remove all books from books purchased file

    how can you remove all ibook from purchased file

    When I connected my iPhone, it automatically synced right away. I did click on the iPhone button and saw the contents of my iPhone including the Books. When I clicked that 'Books' button. But since the book in question was not on my iPhone, it did not show up in the list so I could not select it like you suggested. Therefore I could not sync that book to my iPhone. Thanks for the help though.
    The good news is I did manage to get the book on to my iPhone.
    When her book came out for preorder about a year or two ago, I looked for it in the iTunes store and preordered it. About a week after it came out, I found what was basically the same book for a dollar more. ($7.99 and $8.99) I figured there must be something additional (features) in the $8.99 book. So I bought it too. As far as I could tell though, they were exactly the same. So I decided to hide one of them so they would not both show up in my Library. Anyway, I went to my iTunes/iBooks account and managed the hidden books area. I unhid the Demi book and then it showed up in my iCloud to download on my iPhone. Now they are both on my computer so I need to figure out which one is the other one and hide it. So then I can delete it from my computer just have the one that is on my iPhone on both systems. But at least I found a way to get a copy on my iPhone.

  • Can't Login to SharePoint as an invited External User / Can't Remove All Traces of External User with Microsoft Account

    Hi TechNet,
    I have an MS SharePoint Online (SharePoint Plan 2) team site, quite simple, one document library etc.
    I have successfully added all users (E3) within the organisation to groups, and permissioned correctly.
    I have added myself (separate organisation, also Office 365 E3) as an External User, and have access to the website without any problems by authenticating with my Organization account e-mail address.
    I have a single user (separate organisation, also Office 365 E3), who's setup is identical to mine (Also Office 365 E3).
    However, when this user is added as an External User, they are unable to login, and get "Sign In is not complete":
    That didn't work
    We're sorry, but [email protected] can't be found in the CLIENT1.sharepoint.com directory. Please try again later, while we try to automatically fix this for you. 
    Correlation ID: dc1f7f9c-092b-20b8-7b35-89348ba22f71
    Date and Time: 3/20/2014 7:06:55 AM
    URL: https://CLIENT1.sharepoint.com/
    User: [email protected]
    Issue Type: Partner User Invalid.    
    I then remove the user using the Site Collection, and using the PRofile Manager, and using Remove-SPOUser, and using Remove-SPOExternalUser. Which is great, he's gone. However when I go to add him back to a group, as soon as I type his e-mail address, it
    'Resolves' into his full name! If I have completely(?) removed him form the site, how is he being resolved? And therefore me trying to remove him to re-add him to try and solve the user/directory/auth issue is not working.
    Furthermore, upon clicking on said client's username inside SharePoint (after I've 'added him back' of course), his ID, in format: i:0#.f|membership|live.com#[email protected] has an entirely different e-mail address, his Microsoft Account! 
    I'm assuming he must have been already signed into his Microsoft Account when he clicked on the External User e-mail invite? If so, I clearly do not want this, how can I remove lal traces of his Microsoft Account, given that I have gone to the lengths as
    detailed above?
    I have already completed these steps: http://community.office365.com/en-us/forums/148/p/228263/709905.aspx
    Some possible further reading regarding Microsoft ID's and Organization ID's:
    http://sergeluca.wordpress.com/2013/09/23/sharepoint-online-and-external-users-this-invitation-has-already-been-accepted-with-another-account-bug-or-feature/
    Please let me know if you need any more information regarding this issue, and thanks in advance to anyone who can shed some light on this situation for me and anyone whom encounters it in the future.
    Regards,
    Evanly.

    Hi Scott,
    Thank you so much for taking the time to read and respond to my issue.
    Certainly, it makes sense that regardless of where the invitation it sent, the user would authenticate with their Microsoft ID.
    In my case, I want the user to authenticate using their Microsoft Organisation ID, that they use for their seperate Office 365 account.
    This is the way I was able to log in, and worked great. With my client, they are unable to access Sharepoint because once they sign in with their Microsoft Organisation / Office 365 ID, they are told they are not in the directory, because their Microsoft
    ID is in the directory and it doesn't match up.
    I am simultaneously trying to 1) Remove all traces of this users Microsoft ID, which so far using the above steps, has been unsuccessful; and 2) Invite the user using his Microsoft Organisation ID, and have him authenticate with that (which is proved to
    work, as my account uses this).
    Looking forward to any more suggestions. Thanks in advance!

  • How Can I Remove All the Links in a Document?

    I want to remove all the internal and external bound links in
    a number of my html documents. Is there any way I can do this with
    one action. I tried using Control + F on </a> and replacing
    it with nothing and that works. But Control + F on <a
    href="URL"> doesn't work as the url for that is different every
    time.
    Is it possible to remove all the links in one sweep, I hate
    to do it manually one by one as there are just so many?

    Tanim23 wrote:
    > Is it possible to remove all the links in one sweep
    Yes. In the Find and Replace dialog box, set Search to
    Specific Tag, and
    select a in the drop-down menu alongside. Then set Action to
    Strip Tag.
    You can do this in the current document, a particular folder,
    or the
    entire site, depending on what you select in the Find in
    drop-down menu.
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS4",
    "PHP Solutions" & "PHP Object-Oriented Solutions"
    http://foundationphp.com/

  • How can I remove all my bookmarks from iCloud and start a fresh with only the ones on my iMac

    I accidentally deleted bookmark gilders on my iPad 4 and iCloud removed them from my iMac, iPhone 5, iPhone 4, iPad 2 and MacBook Pro. I turned off Safari on all devices for syncing with iCloud and used Time Machine to restore my Bookmarks.plist on my iMac, but iCloud keeps removing it and replacing the plist with the latest version. I want to remove all the Safari a bookmarks from iCloud, but don't know how to do this, can anyone help.

    Just a note about the difference between these two things:
    * "export" and "import" use an ancient HTML document format that all browsers can understand. When you import bookmarks, Firefox may place them into an Imported Bookmarks folder, or into Unsorted Bookmarks. This does not displace existing bookmarks, and Firefox does not automatically remove duplicates.
    * "backup" and "restore" use a more comprehensive JSON data file, which contains extra information about your bookmarks (such as tags) not contained in the traditional export file. HOWEVER, a restore completely replaces all existing bookmarks, so the restore feature cannot be used to merge in a set of additional bookmarks.
    Related support articles:
    * [[Export Firefox bookmarks to an HTML file to back up or transfer bookmarks]]
    * [[Import Bookmarks from a HTML file]]
    * [[Restore bookmarks from backup or move them to another computer]]
    Some users find the disk-based Windows Favorites folder a convenient way to organize bookmarks. If you do, too, and you do not need to preserve tags on your bookmarks, you could export each profile's bookmarks to HTML and import them all into IE11. Organize them in the Windows Favorites folder, then export from IE11 to HTML and import that file into each Firefox profile. See: [http://windows.microsoft.com/en-us/internet-explorer/add-view-organize-favorites].

  • How can I remove all the music from my iPhone?

    I want to remove all the music from my iPhone 5 (Current iOS) and then load a completely new set of songs from my Mac (Current OS).
    How do I do that ? 
    Even when I define a specific new playlist and tell it to apply only that it still does not remove the unwanted songs.
    Thanks !

    I feel I've explained plenty what you must do but you aren't getting it.
    All music on your old iPhone should be in your iTunes library on your computer. Transfer the music from your iTunes library on your computer to your new iPhone in the same way it was transferred from your iTunes library to your old iPhone - via the iTunes sync/transfer process.
    Since you prefer the manual way, you must manually drag and drop the same 377 songs from your iTunes library to your new iPhone - in the same way the 377 songs were manually transferred from your iTunes library to your old iPhone.
    Or you can sync which provides more options overall. Create an iTunes playlist for the 377 songs. Select Sync Music under the Music tab for your iPhone sync preferences with iTunes and choose selected playlists, artists, albums, and genres. Select the iTunes playlist below that includes the 377 songs followed by a sync.  

Maybe you are looking for

  • How to cancel automatic registration of some files when exploring

    When I search and explore on a certain subject with one or a few words on Google for an example, many pages are opening. It is normal until there. But when I click on some pages, in format as PDF, RTF, they automatically download and register on my d

  • How to setup a Currency Translation in BW Query for Universe purpose

    Hello, we want to setup a currency translation in a BW Query, to be able to select the target currency in the Report, so that all vallues are translated (not filtered) in the target currency. Any ideas.

  • Archlinux runs slow

    After installing arch linux I noticed laggy responce with the console.  For instance, when I type ls in my home directory it'll sometimes take 2-5 seconds before it'll list the contents.  Is this because it's using reiserfs or devfs?  I assumed they

  • Image in Discoverer Report

    Hi All, I have a customer who wants to include images in a Discoverer report. He has a BLOB database column which has images. He wants these images to appear in his report. Is it possible to do this? If not, will a future version have this feature? t

  • Why can't I hear the person I'm calling???

    Ok I know the subject line sounds like I'm a couple sandwiches short of a picnic.  But honestly just a couple days ago my Blackberry phone rang, I go to answer the call and I can't hear the caller on the phone, but they can hear me.  The only way I c