Ungroup selected items and delete them

Hello!
I have a code that removes the tags (if there are tags) from objects and then deletes them.
The problem is if tagged objects are grouped. Or even grouped objects in another group.
I need to ungroup the selected objects and then untagging and deleting them.
How can i do this?
My current code:
for (var iSel = app.activeDocument.selection.length-1; iSel >=0 ; iSel--){
     var currentSelection = app.selection[iSel];
          if (currentSelection.associatedXMLElement != null) {
               currentSelection.associatedXMLElement.untag();
               currentSelection.remove();
          else {
               currentSelection.remove();

I think we need an extra loop through all pageItems of the selection, checking the tag names.
You could assemble the length of the found objects tagged with "product". If the length is not 0, use a confirm dialog like that: "You are about to untag and delete [number] of objects tagged "product". Do you really want to do that?" [No] [Yes]. If [No] is clicked, the script will stop.
"Confirm" is documented here:
http://jongware.mit.edu/idcsjs5.5/pc_Window (SUI).html#confirm
For an example in usage look here:
//Select an object that can get a fill color and run the script snippet:
var myResult = confirm("Would you like to color your selection with \"Yellow\"?");
if(myResult === false){
    //Do nothing!
    exit();
if(myResult === true){
    app.selection[0].fillColor = "Yellow";
Uwe
PS. I'll be offline the next few hours…

Similar Messages

  • Javascript, IllustratorCS3, select items and change layers

    Hi
    I am trying to select an object defined with fill color Cyan and move that object to another layer. Is there any way to do this with JavaScript? Could you please help.
    PS: I want script to select that object, not the user.
    Thanks
    Sel KAHRAMAN

    Thanks for your reply Yann,
    I already know how to change the texts, the problem is that the texts I would like to change:
    To select old purchase orders or templates, choose
    Then select items and add them to the shopping cart 
    Are not in the list of attributes/texts...
    Where can this text be located?
    I find it hard to believe that it is hardcoded...

  • Can Select Items be Deleted from Trash?

    I would like to delete certain items from the Trash but am not sure about deleting others. Is there any way I can highlight a certain item or items and delete them without deleting ALL the Trash contents. Thank you.

    Would you suggest this Trash Considerations (or whatever) be a folder on the Desktop or would someplace else ie: Documents be a better spot?
    Whatever is conveient for you... once made, you can even drag that folder's icon to the Dock between Applications & Trash for convenience.
    is it safe to empty the Trash even though a copy remains in there.
    In theory yes, but check to see it's still in your Applications folder... and do a Get Info on it from there to make certain it doesn't mention Trash in the Location.
    Dumb question likely, but I have a thousand more like it
    My personal opinion is that there are really no dumb questions... only dumb answers or failure to communicate... which is a two way street, so feel quite fee to ask away... we'll figure it out sooner or later!

  • When is there going to be a select all/delete all option in email? I need to search for certain emails and delet them from my phone but not my email program (Outlook)

    when will there be a select all/delete all option in Emails? I have a large number of emails that come to my phone which i dont want to delete from my outlook mail account (On my PC). However, i want to be able to search, select all and delete these emails from my phone? I do not use ICloud either as it causes issues with my calendars at work.
    These features should be a standard as there are plenty of other users out there that are trying to do the same thing and as yet there has been no progress? The email on the iphone is one of the biggest downfalls of the phone, blackberry and android handle them much better, but i dont have an option with my phone at work. Please help??

    No one here would have any idea when or if such a feature would be introduced until and unless Apple announces it.

  • Is there any way to select all mail messages and delete them?

    I get lots of mail, and most of it I don't keep, or keep over on my MacBook. Is there a way to select all the Mail messages and delete them, or do I need to go through them one at a time?
    many thanks!
    Jeannette
    <Edited by Host>

    In your inbox in the phone you can mark the mails one by one and then tab delete.
    In Trash you can delete all with one tab.

  • HT201210 Contact List Problem.   I have duplicates on my iPhone.  I turned off my Contact and selected "Delete Contacts"  Most of the contacts were deleted but about 120 were left on my phone.   I've tried selecting individual contacts and deleting them,

    Contact List Problem.   I have duplicates on my iPhone.  I turned off my Contact and selected "Delete Contacts"  Most of the contacts were deleted but about 120 were left on my phone.   I've tried selecting individual contacts and deleting them, No Go. 
    Can anyone help?   How do I get rid of these contacts so I can re-synch my iPhone. 

    I have exactly the same problem on my ipad. It is happening on only some contacts but, as with you, when I delete one of the contacts on the ipad, the second ipad contact and the contact on the imac are also deleted. This is even the case when I have differentiated the two contacts on the ipad and can see the one I have deleted on the ipad is not the same one as is then deleted on the imac.

  • I want to delete my duplicate songs, but I have thousands of songs and cannot realistically go through and review and delete them one at a time.  Can I do it all at once?

    I want to delete my duplicate songs, but I have thousands of songs and cannot realistically go through and review and delete them one at a time.  Can I do it all at once?

    Apple's official advice is here... HT2905 - How to find and remove duplicate items in your iTunes library. It is a manual process and the article fails to explain some of the potential pitfalls.
    Use Shift > View > Show Exact Duplicate Items to display duplicates as this is normally a more useful selection. You need to manually select all but one of each group to remove. Sorting the list by Date Added may make it easier to select the appropriate tracks, however this works best when performed immediately after the dupes have been created.  If you have multiple entries in iTunes connected to the same file on the hard drive then don't send to the recycle bin.
    Use my DeDuper script if you're not sure, don't want to do it by hand, or want to preserve ratings, play counts and playlist membership. See this thread for background and please take note of the warning to backup your library before deduping.
    (If you don't see the menu bar press ALT to show it temporarily or CTRL+B to keep it displayed)
    tt2

  • App store apps and deleting them

    when you buy an app from the mac app store. Is it self contained? If you remove it, does it automatically take with it any preference files, etc..or does it leave them behind?  Just curious, as I haven't used it yet and was thinking about using a few free apps, but want to know what happens if I want to delete them..

    No. Any application may install files in other locations. If you wish to delete one then you may wish to remove any other files it installs that are not in the application's package. See:
    Uninstalling Software: The Basics
    Most OS X applications are completely self-contained "packages" that can be uninstalled by simply dragging the application to the Trash.  Applications may create preference files that are stored in the /Home/Library/Preferences/ folder.  Although they do nothing once you delete the associated application, they do take up some disk space.  If you want you can look for them in the above location and delete them, too.
    Some applications may install an uninstaller program that can be used to remove the application.  In some cases the uninstaller may be part of the application's installer, and is invoked by clicking on a Customize button that will appear during the install process.
    Some applications may install components in the /Home/Library/Applications Support/ folder.  You can also check there to see if the application has created a folder.  You can also delete the folder that's in the Applications Support folder.  Again, they don't do anything but take up disk space once the application is trashed.
    Some applications may install a startupitem or a Log In item.  Startupitems are usually installed in the /Library/StartupItems/ folder and less often in the /Home/Library/StartupItems/ folder.  Log In Items are set in the Accounts preferences.  Open System Preferences, click on the Accounts icon, then click on the LogIn Items tab.  Locate the item in the list for the application you want to remove and click on the "-" button to delete it from the list.
    Some software use startup daemons or agents that are a new feature of the OS.  Look for them in /Library/LaunchAgents/ and /Library/LaunchDaemons/ or in /Home/Library/LaunchAgents/.
    If an application installs any other files the best way to track them down is to do a Finder search using the application name or the developer name as the search term.  Unfortunately Spotlight will not look in certain folders by default.  You can modify Spotlight's behavior or use a third-party search utility, Easy Find, instead.  Download Easy Find at VersionTracker or MacUpdate.
    Some applications install a receipt in the /Library/Receipts/ folder.  Usually with the same name as the program or the developer.  The item generally has a ".pkg" extension.  Be sure you also delete this item as some programs use it to determine if it's already installed.
    There are many utilities that can uninstall applications.  Here is a selection:
    AppZapper
    Automaton
    Hazel
    CleanApp
    Yank
    SuperPop
    Uninstaller
    Spring Cleaning
    Look for them at VersionTracker or MacUpdate.
    For more information visit The XLab FAQs and read the FAQ on removing software.

  • I just downloaded 950 photos on iPhoto and deleted them off my camera and now under last import there is only 4 photos and i can't find the others?? There is a whole bunch of blank events in the library with no photos in them all with todays date? Help!!

    I just downloaded 950 photos on iPhoto and deleted them off my camera and now under last import there is only 4 photos and i can't find the others?? There is a whole bunch of blank events in the library with no photos in them all with todays date? Help!!

    Yes - you need a min of 10 GB just to operate - with just 1 you certainly can lose photos and other critical things - you need to make space immediately - probably by moving your iPhoto library to a volume formatted Mac OS extended -
    Moving the iPhoto library is safe and simple - quit iPhoto and drag the iPhoto library intact as a single entity to the external drive - depress the option key and launch iPhoto using the "select library" option to point to the new location on the external drive - fully test it and then trash the old library on the internal drive (test one more time prior to emptying the trash)
    And be sure that the External drive is formatted Mac OS extended (journaled) (iPhoto does not work with drives with other formats) and that it is always available prior to launching iPhoto
    And backup soon and often - having your iPhoto library on an external drive is not a backup and if you are using Time Machine you need to check and be sure that TM is backing up your external drive
    LN

  • Is there a way to listen tracks from my harddrive and delete them directly?

    Hello Everybody,
    I have a simple thing i like to do, but i can't figure out how to do it..
    I have a lot of music on my external harddrive, and i want to listen to a track and if i don't like it i want to delete it.
    I don't like using itunes, because a lot of tracks are not part of an album and then i can never find them again. I use traktor to browse to my folders, but from that program i can't delete the tracks. Then i have to search for the track in finder..and delete it from there.
    Is there a way to listen to my tracks from my harddrive and delete them on the spot?
    kind regards,
    Marco

    Rocam wrote:
    i cannot delete a track from itunes and directly from my harddrive at the same time...
    Well you can place it in the Trash, then delete the Trash all at once.
    Right click on the song in the Library and select Delete.
    This next window can be prevented to show again by checking the Do Not Ask Me Again box
    Bam, click the Move to Trash and it's in the Trash,
    when your done for the day, before you remove any media, you click Finder > Empty Trash and they are all gone at one time.
    This method is better in case you make a mistake, you can grab it out of the Trash and put it back.
    I think the Delete key on the keyboard is even faster than the right click selection, you'll have to find out.
    You also can use something like QuickKeys and scheduale a sequence of mouse click events so a simple keystroke like Control D can delete the song to the Trash.

  • How do I search for lines with a particular pattern and delete them when a match occurs

    How do I search for lines with a particular patter and delete them when a match occurs? For example delete lines containing SUB_NAME = "?" where ? is any string. 

    How do I search for lines with a particular patter and delete them when a match occurs? For example delete lines containing SUB_NAME = "?" where ? is any string. 
    Lines in what? And what language are you using to develop with?
    Are the lines in a text file? A RichTextBox? A TextBox? Some other control? A List(Of String)?
    Is there some expectation by you that by providing what you wrote in your question post that the knowledge in your mind about what you are thinking about will mysteriously emanate to anybody reading your post so all of the sudden your knowledge will
    become their knowledge and they will be able to provide you with an answer as they will suddenly understand what you are trying to do? Because that's probably impossible. Most people try providing enough information in a question so anybody, even stupid people
    like me, can understand what they want. Maybe you should try that. As well as selecting an appropriate forum for your question in the future. Usually a question like this is related to programming in a particular language therefore a language forum may be
    a good choice. Or not.
    La vida loca

  • I have Lightroom 4 and my hard drive is getting too full wiht pictures i have in lightroom. I want to move many to a thumbdrive and delete them from lightroom. what are the steps to perform this please ?

    I have Lightroom 4 and my hard drive is getting too full wiht pictures i have in lightroom. I want to move many to a thumbdrive and delete them from lightroom. what are the steps to perform this please ?

    If you want to be able to view, edit and export from Lightroom you can move the files using your computer OS (explorer or finder) and update the folder location by right-clicking on the folder name in the LR Library. See fig 8 at the attached link:
    http://www.computer-darkroom.com/lr2_find_folder/find-folder.htm
    This will work when the thumb drive is connected.
    If you really have no need to keep these files off-line in LR then simply move the files, select all the thumbnails in the LR Library and hit delete. Then choose remove.

  • I'm having problems (1)selecting onscreen text, (2) having problems resizing menu boxes and selecting menues with the cursor. I'm not able to select menus and move them. I'm not sure how to correct this.

    I'm having problems (1) selecting onscreen text, (2) resizing menu boxes and selecting menues with the cursor. I'm not able to select menus and move them. I'm not sure how to correct this.

    1) This is because of software version 1.1. See this
    thread for some options as to how to go back to 1.0,
    which will correct the problem...
    http://discussions.apple.com/thread.jspa?threadID=3754
    59&tstart=0
    2) This tends to happen after videos. Give the iPod a
    minute or two to readjust. It should now be more
    accurate.
    3) This?
    iPod shows a folder icon with exclamation
    point
    4) Restore the iPod
    5) Try these...
    iPod Only Shows An Apple Logo and Will Not Start
    Up
    iPod Only Shows An Apple Logo
    I think 3,4, and 5 are related. Try the options I
    posted for each one.
    btabz
    I just noticed that one of the restore methods you posted was to put it into Disk Mode First rather than just use the resstore straight off, I Have tried that and seems to have solved the problem, If it has thank you. previously I have only tried just restoring it skipping this extra step. Hope my iPod stays healthy, if it doesnt its a warrenty job me thinks any way thanks again

  • I've just discovered that with the newest version of iTunes you can no longer delete apps you don't want.  You used to be able to do so by connecting to to desktop computer and delete them.  Tech support said you can't delete apps anymore.  Not Good!

    I've just discovered that with the newest version of iTunes you can no longer delete iPod Touch/iPhone apps you don't want.  You used to be able to do so by going onto iTunes on your desktop computer and deleting them.   Not Good!  I just called tech support and they said that in this version there is no way to delete them. They also said there have been numerous complaints about this.  You can't even delete them from your applications folder.  It's as though you're being held hostage to apps you tried, but do not want.
    While we're on the subject, I don't like the fact the the iPod touch comes with unistalable apps such as: Passbook, Nike & iPod, Newsstand, and Game Center. Don't want them, will never use them.  Give customers the option to delete apps that we don't want.  Call Apple's corporate customer care. escalation, and complain untill they fix this.

    Actually,
    Step 1:
    Step 2.
    Step 3.
    Step 4.
    Step 5.
    One of us must be wrong.

  • Can i keep files into my time capsule and delete them from my mac?

    i have to many files in my mac and i'm running out of space so i want to put the photos and music only on my time capsule and delete them from my mac, is that possible?

    Welcome to the Apple Support Communities
    Of course you can do that, but it won't work if you are using the Time Capsule to make backups. In this case, I recommend to leave your Time Capsule as your backup drive and buy an external drive to put your photos and music on it.
    If you aren't using your Time Capsule for that, you can do it

Maybe you are looking for

  • My IP4 on/off switch has stopped functioning.

    My On/Off switch has stopped functioning. No depression, no click and no response. Has anyone else had this problem and if so, did you solve it? How?

  • /boot not preent in Non-Global zones

    Hi, /boot directory is not present in non-global zones. Is there any specific reason for that? On sun x86 uses /boot/solaris/bootenv.rc to duplicate the “eeprom” functionality. Since bootenv.rc is used for boot prom functionality and /boot itself not

  • 10g Rename Offline Database Object Broken

    I am trying to rename an offline database object. I opened the editor on the object, updated its name and the names of a few of its foreign keys. At first, it appeared to work. The object in the Navigator had the new name, and when I opened a diagram

  • Add addition import duty cost to materials  for costing run

    Hi All, Whats the best solution to add the additional cost of import duty on materials imported into China? Is adding an additive cost (CK74N) possible and the best solution? This way it will be picked up automatically in costing run? Cheers Tony

  • "invalid URL" download prob on powerbook but not imac...

    I have been down loading some movies on my imac with no problem. They are WMVs but I have the latest flip for mac (2.2) installed, running in the latest version of Leopard. In Safari, I open the download link in a new tab and the movie opens within t