Applescript to delete from selected layer and page

Hi,
This is part of a bigger script, but this is where I am having the problem. Hopefully very easy to solve, but driving me mad.
I want to delete a text box from the active page only, and only from one layer.
I can get it to work on one layer, but all pages. And on one page, but all layers.
Could someone please help me write the line to select both active page and layer "slug".
Thanks,
Matt
tell application "Adobe InDesign CS5"
activate
          set myDocument to active document
          set myActivePage to the active page of the active window
          set myLayer to layer "Slug" of myDocument
          tell myLayer
    tell myActivePage
       ungroup groups
       delete (every text frame whose contents contains "delete me")
    end tell
          end tell
end tell

G'day
It's a hassle, isn't it.
I've only got CS2 at home, so I haven't had a chance to test this in CS5 — but you need something like this :
tell application "Adobe InDesign CS5"
    activate
    tell active document
        tell active page of layout window 1
            try
                ungroup groups
            end try
            set theseFrames to (every text frame whose contents contains "delete me")
        end tell
        repeat with thisFrame in theseFrames
            if item layer of thisFrame is layer "Slug" then
                delete thisFrame
            end if
        end repeat
    end tell
end tell
hope that helps
m.

Similar Messages

  • I am trying to free up some room on my touch and am unable to delete any songs or books from the listing.  With iTumes open and my touch listed I open the touch.  I then select the items I want to delete from the touch and press the delete button.

    I am trying to free up some room on my touch and am unable to delete any songs or books from the listing.  With iTumes open and my touch listed I open the touch.  I then select the items I want to delete from the touch and press the delete button.  Nothing happens.  I have also tried to right click on the item, but a delete option is not listed.  What do I need to do to get rid of some books?

    Open itunes, connect ipod, go to each tab, select what you want to be on the ipod, sync

  • How can I stop music and movies from being automatically deleted from my phone and saved on the cloud? I've just tried to watch a movie on my 2 hour commute, but yet AGAIN it has been removed. I do NOT want to spank all of my data allowance

    How can I stop music and movies from being automatically deleted from my phone and saved on the cloud? I've just tried to watch a movie on my 2 hour commute, but yet AGAIN it has been removed. I do NOT want to spank all of my data allowance downloading it again, especially because (believe it or not) I added it to my phone because that's precisely where I wanted it!! Any help much appreciated

    FYI I had to put this link into firefox to reply - because **** back safari just wouldn't register my clicks to any of the links on the post... Despite reloadeing and even restarting my computer. Totally annoying and a massive pain in the ***.
    But in terms of my initial query; thanks for responding. But no, this is NOT the cause of the problem. I have auto sync and sync over wifi activated, but have also selected manually manage music and videos. Plus, all of my music and videos are on my macbook, absolutely all of it, so if it my phone was syncing with my macbook everything would still be on the phone. Life would be peachy if my phone jsut copied everything that was on my macbook, but unfortuantely it keeps deleting tracks for no apparent reason.
    Any thoughts greatly welcomed, because at the moment i can only conclude that my iphone is crap.

  • Could not complete the new 3D extrusion from selected layer command because the path is too complex.

    I was trying to do a photo of mine like in this video but its not working help needed. thanks.
    http://www.youtube.com/watch?v=egyLY78H7nE
    When I tried the 3D I got an error message that said (could not complete the new 3D extrusion from selected layer command because the path is too complex.) what does this mean and how can i fix it?

    There was a bug at one time where really simple paths (like a triangle, for example) could cause that error.
    Is your path really simple (I don't plan to go watch the video)?  If so, have you installed the latest update for Photoshop?  That bug may have been fixed already.
    If it's not that, it's possible that if your path is really complex and simply exceeding Photoshop's capability.
    -Noel

  • Problem with "Create New Extrusion from Selected Layer" CC 2014

    Hello, I'm experienced with Photoshop but am new to 3D text in Photoshop.  I type in some text and convert to a shape.  When I choose Create New Extrusion from Selected Layer I get  dialog box I don't see in any tutorials.  It says "You are about to create a 3D layer.  Would you like to switch to the 3D workspace?  Yes/No, Don't show again."  Which should I use for 3D text? 
    If I choose Yes, all the panels go away and the content in the tool options bar (ribbon?) just under the menu bar go away.  I have to restart Photoshop to get the tool options back.  What could I be doing wrong?
    Thanks - Dave

    I just chose "No" and didn't look back.  I like my workspace just as it is, and don't prefer Photoshop to change it for me under this particular case.
    You can make the 3D panel visible yourself via Window - 3D.  I find it's a good alternate for the Actions panel, as I don't have any actions at the moment that work in the 3D world.
    The panels you'll want to see easily if you work on 3D are the 3D panel and the Properties panel, among a few others.
    Regarding getting your workspace back the way you like it...  Note the little selector near the upper-right corner of the Photoshop main window.  That can be used to select a workspace.  I suggest you experiment and get familiar with the concept of workspaces.  You can define your own and save it with a name, and that truly can be helpful.
    -Noel

  • How do I restore purchased songs that I previously deleted from my library and icloud?

    How do I re-download purchased song that I previously deleted from my library and icloud?

    Go to the iTunes Store and click on "Purchased" then on the next screen click "Not in my library".   You should be able to select it from there.

  • HT204053 My wife and I have an iphone each using one apple id. How do we stop items being deleted from one phone and then find it has been deleted from the other?

    My wife and I have an iphone each using one apple id. How do we stop phone contacts being deleted from one phone and then find it has been deleted from the other?
    Also this works when one of us downloads an app it appears on the other iphone

    You need to use separate iCloud accounts. This will mean that you can both have your own separate contracts and calendars and put an end to them being deleted by each other.
    Whether or not you have a separate iTunes account, is up to you. If you have a separate iTunes accounts you will not be able to access the music, books, apps that have been purchased by the other. This may be exactly what you want, but it also means that you both may end up purchasing the same item.

  • My contacts all got deleted from my phone, and was replaced with names and numbers of people I've never met before.

    My phone was working as normal, then all of a sudden when I checked my text messages all the names of my contacts got replaced by their actual phone numbers. When I checked my contacts, it looks like everyone got deleted from my phone, and was replaced with names and numbers of people I've never met before. Even when I check my icloud for a backup it has the same issue. I don't know how this is possible and not certain as to how to rectify and get my contacts back.

    Hi Also iPhone, need update to ios 8.1.2 do this over WiFi Use same Apple ID & Password. Cheers Brian

  • Will my music and playlist be there if Itunes is deleted from my computer and I reinstall it

    Will my music and playlist be there if Itunes is deleted from my computer and I reinstall it*

    Yes, you can uninstall and reinstall iTunes without damaging your library.
    For general advice see Troubleshooting issues with iTunes for Windows updates.
    tt2

  • Hello, All my sonds are deleted from my laptop and from Itunes. If i synch my iphone to my itunes all my music will go. How do i prevent losing all my music?

    Hello, All my sonds are deleted from my laptop and from Itunes. If i synch my iphone to my itunes all my music will go. How do i prevent losing all my music?

    There's some third party applications available for recovering content off an iPod, iPhone or iPad. The following article is pretty old (2008) so it would be best to reality-check the capabilities and availability of the various listed items prior to opting for a particular product:
    http://www.ilounge.com/index.php/articles/comments/copying-music-from-ipod-to-co mputer/P2

  • Hi , unfortunately i faced with a problem that i couldent open my audio note so i thought if i delet it and transfer the application from itunse from my pc i can have my files...but all of them deleted from both application and also from wifi address... I

    Hi , unfortunately i faced with a problem that i couldent open my audio note so i thought if i delet it and transfer the application from itunse from my pc i can have my files...but all of them deleted from both application and also from wifi address... Is it any solution for recovery the filew? I missed lots of important files , plz help me
    Tnx alot

    Hey Eric,
    Thanks for taking the time. Unfortunately no that does not solve it. Same as swipe it will get me there and it will show separate programs spaced out. The issue I am having is that all my open word files are bunched up in a pile on top of each other. I can see the edges of each one but I want them to be separated from each other enough that I can visually identify what file is what.
    Again, thanks for trying, it is appreciated.

  • Blackberry Messenger deleted from my phone and cannot reinstall with upgraded version

    Hi,
    There is am icon on my phone requesting I upgrade BB Messenger but when I tried to do it it failed. Now BB messenger has been completely deleted from my phone and cannot reinstall.
    I read that new version is for devices of 4.5 and above. Mine is 4.2. What do I do to get messenger back unto my phone?

    try this link it is where i upgraded my BBM from
    http://na.blackberry.com/eng/devices/features/im/blackberry_messenger.jsp

  • HT201320 Once I have downloaded email on my iPad the same is not downloaded on my laptop. Have tried all settings including choosing the setting DELETE FROM SERVER:NEVER and REMOVE FROM SERVER:NEVER

    Once I have downloaded email on my iPad the same is not downloaded on my laptop. Have tried all settings including choosing the setting DELETE FROM SERVER:NEVER and REMOVE FROM SERVER:NEVER

    Hey rbrylawski, just wanted to let you know that my ipad email problems have been solved. Called Apple Sup in OZ, I'm in NZ. Daniel Barber was the support tech from heaven!! I was about to return the ipad but solving this issue reset my faith in phone support.....perhaps until I call a differnet companys phone support eh? Anyhow, for reference the fix is below.  My accounts are all POP not IMAP, and the primary smtp server setting had defaulted to have SSL switched on and the port was set to 5XX (something, cant remember). Anyhow, SSL was switched off and the port was swithced to 25. VOILÀ!!  Settings/Mail, contacts, calendars/My POP mail account/smtp/primary server/ >>> server on, no username and password,  use SSL off,  no authentication,  Server Port 25  Thanks for having a crack at it. This might help when assisting another user. Cheers Tonino

  • Deleting photos from last imported also deletes from all imported and videos..how do I keep one of the albums and not the other?

    I downloaded photos from digital camera and created imported photos and videos(want to keep this one) and last imported and all imported "albums".  Too much space.  As I deleted the all imported group the same pictures deleted from last imported and the import and video groups.  How do I keep on one of the albums an my iPad so I have easy access to them?

    That is how the Photos app works, when you 'copy' a photo into an album that you've created in the app then you are effectively just creating a pointer to the photo, you're not creating a separate copy of the photo - so if you delete the original photo you will also be deleting all pointers to the photo, and it will therefore be removed from any albums that you've 'copied' it into.

  • Deleting from iTunes Library and Computer

    I have alot of music in my library that I would also like to remove from my computer. I know that when you select a song and press the delete key that i prompt pops up asking you if you want to delete the song from your computer as well as your library...for some reason i think i may have clicked the "don't show me this again tab" and now when i delete a song from my library it only gets deleted from the library. If I want to delete it from my computer I have to go and search for the file in the folder where it is stored...this is a royal pain in the butt because sometimes music files aren't labeled conveniently. So my question is : Is there some way that I can turn that prompt back on so that I can delete songs from my computer and iTunes library alot easier and faster? Any insight would be greatly appreciated.
    HP Tablet PC   Windows XP  

    Do you keep your songs in the iTunes Music folder or do you use another folder of your own making? iTunes will delete songs from the library and move them to Trash only if they are in the iTunes Music folder. (iTunes will ask if you want to trash the file if this is the case, it doesn't trash it automatically). If your songs are kept outside of this folder then deleting only removes the reference to the song from the library and you have to go to the folder they are located in to trash the file itself.
    Message was edited by: Zevoneer

Maybe you are looking for

  • MacBook Hinge - Uneven Gap

    I have a white MacBook that developed the hairline crack problem. Apple replaced the top and bottom cases, so the cracks have gone. However, in replacing those parts, Apple didn't put the top case back on quite right. It's hard to explain, but when t

  • Adding internal hd - stock drive?

    I've been reading a lot of posts about hard drives, but haven't found this answer. When I buy my Mac Pro, I plan to buy and install a 500G hard drive for use as my main boot drive. The 250G stock drive, I plan to use for Win XP/bootcamp. I know I can

  • Why have category colours suddenly vanished from my calendar?

    I have several categories for events in my calendar. I have selected different colours for each. Until a few days ago, these colours showed on my calendar - down the side of my events. Any idea why they don't show any more?

  • Repeat option missing in iCal

    I went into iCal to edit a new event and there is no repeat option now!  There is the option for an alert or invite, but no way to set this event to repeat.  HELP.

  • Is Advanced Port Replicator III plus compatible with Portege R200

    I just ordered a new Portege R200 and the above port-replicator... however, I note that the R200 isn't listed in the supported notebooks list for that replicator! Can anyone confirm if I have made a mistake and need to change the order? Will