Illustrator Scripting :: Ungroup All Groups Then Create A Single Group?
Jul 30, 2013
I'm having trouble getting a script together where I can ungroup all groups in a document, then put everything under a single group. Everyhting I'm working with has a single layer, but for some of the arts I'm importing have groups within groups ect. To run certain actions I've made properly after I need eveything to be in one, single group.
I searched for an answer and found this (wirtten by Carlos Canto)
function ungroup(whereToUngroup, group) // where to ungroup? layer, document, other group?
{
for (i=group.pageItems.length-1; i>=0; i--)
group.pageItems[i].move(whereToUngroup, ElementPlacement.PLACEATBEGINNING);
}
Using LT 2014. If I select a few lines and group them, I can select that group, right click, and ungroup them. No problem.
If I group a few lines, then make another group of a few lines, then group the two groups together, then the right click menu will no longer allow me to choose ungroup. Also on the ribbon, the ungroup icon will not operate.
Before this I had LT 2011 (and before that) and I was able to group/ungroup multiple grouped objects at will. So this appears to be a glitch that was introduced since then.
I have a dwg showing both sides of a dinette. One side ("Left Booth") was grouped & then duplicated. The duplicate ("Right Booth") was mirrored and moved to the other side. I "UnGrouped" the duplicate ("Right Booth" - not shown in the attached clip), but I can not UnGroup the original "Left Booth" grouping. The original grouping has NO special effects (drop shadow, etc.), simply a group of lines, curves and rectangles. I can't find any "attachment" between the two.
i have 63 grouped objects - some of which include artistic text. I have worked with CD for a while now and have never had this happen. what have i done??
currently I am using autocad 2011. I have worked in the past on autocad 2012. in the 2012 version was a function available to "group" or "ungroup" items. in the 2011 version I can not find the function. was is something they add on in the newer version or do I just overlook it somewhere?
When i call the method selectObjectsOnActiveArtboard on an artboard, is there a way to easily group all items in the selection? Like in the menu found under "right click > group"
I have a document with a single layer and a single group (GroupItem) in that layer.
Unfortunately, I didn't create the .ai file, so I don't know exactly what is in the group; however, there appears to be a bunch of complex clipping masks and gradient effects, etc. deeply nested within it.
I've successfully scripted a few tasks like resizing the group with no ill effect... in other words, this works as expected:
However, as soon as I try to move/translate/reposition the group, all the effects/masks seem to go wonky, I've tried all of the below with no success (200 is just arbitrary as a test):
I have no problem moving the group around on the document with my mouse... all the effects/masks are still nice and clean, so I'm confused as to why I can't do the same thing via JavaScript.
I have a layer that contains two clipping groups (groups with a clip mask and other art). When I call layer.groupItems it returns an empty array. When I call layer.layers it returns the two clipping groups. I need to know if these layers are clipping groups, but if they are coming back as layers how can I figure that out?
I'm working with imported graphics, and the objects appear in the AI layer hierarchy grouped and named according to their object types in the native program (see the attached image). The problem lies with the annotation objects: they are made of different parts for which different graphic styles are needed; however, they all come in one layer and are difficult to access for global operations. I need to do different things with the different object types (delete the POINT's, move the LINE's and LWPOLYLINE's to different layers, etc...). The option of selecting objects individually is ok for small data sets, but you can imagine this becomes untenable in a hurry.
Two possible solutions I've considered:
(1) change the output parameters in the source program such that the objects come into illustrator with different graphics allowing them to be accessed through the "Select same ..." tools; it would work, but is problematic for the source program
(2) print the annotation graphics with their desired graphic appearance to pdf rather than importing the source file directly in AI, then open in AI to render the remaining graphics; again, this works but introduces inefficiency in the process. Also, the print process tends to explode closed paths requiring more inefficient path tinkering in AI.
I would like to tell AI to select all objects named "POINT" or "LINE" etc... but have found nothing in the documentation or forums on whether this is possible.
All the graphics in my document is selected. I want to deselect groups and leave standalone items selected. How can i make JavaScript recognize a group?
I think I might be doing this wrong, I am trying to get contents of a specific textFrame within first group on layer called "page numbers"
It seems to work, but is a bit sketchy, the documentation indicates textFrame is all the text frames in a document, and that textFrameItem should be the specific one within collections of groups etc, maybe I am misunderstanding. this is what I am using:
var existingPageNumbers = app.activeDocument.layers.getByName('page numbers').groupItems[0].textFrames[0].contents;
I'm new in scripting and i need to make a script that moving all layers into a single layer (in Illustrator i press CTRL+A then CTRL+G in layers and works) but i need that in script.
I jumped to CS6 from CS3 and am a bit confused. I create graphics for stock imagery and it is important to minize the amount of shapes. I created my first image with CS6 that has several gradients and my file is enormous because when I viewed it with "Overprint view" it showed that all gradients consisted of several paths contained in a clip group.
Running a script to open up files and convert to another type. When it gets to a TIFF type file a dialog window titled 'TIFF Import Options' is opening. This windows has an Options column that contains two radio selections for 'Convert Layers to Objects' and 'Flatten Layers to a Single Image'. How would I open the file with the 'flatten layers to a single image' set?
I use my Pshop groups in a similar fashion to how Flash uses Display Object Containers. I have one group containing the rest of my groups serving as a 'master group' so I can perform global transformations to all of my layers. For some reason, it stopped letting me scale.
Using frame animation (yes I'm using frame on purpose, not motion), I would like to get the master group to tween a scale and tranlate. I can get it to translate it's XY coordinates, but for some reason the scale doesn't work anymore. It was working before but not now. I even tried converting the group to a smart object but that doesn't work, and that's fine, I try to avoid smart objects where possible.
How to get this to work or what I might have done wrong to the file?
As I am using Layer Comps more frequently, i find myself frequently needing to toggle the visibility of layer groups, which contain several sub-groups. I tried all the shift + cmd + option - click variations, but none seems to do the trick.
here an example:
Visibility Type Name OFF Group Row ON Group Button 1 OFF Text Help! OFF Shape Bg ON Group Button 2 OFF Text Help Please! OFF Shape Bg
so what i am looking for is a short-cut so that when i click on the visibility of the Group Row, it will turn on the visibility of all the layers contained.
I'm trying to write a script that renames a layer, and group within the layer, then an object within the layer (but not a part of the group) and have it run in a loop.
Here's what I've got so far, the group rename doesn't work.
#target Illustrator var doc = app.activeDocument; idLayers(doc)//IRename layers idGroups(doc)//Rename groups function idLayers(doc){
[code]....
I haven't put in anthing to rename the single object yet since I cant even get the group rename to work. I suspect that the group re-name section isn't working because I'm either using bad syntax or an invalid command.
author one mask that effects multiple layers without using a group mask? Unfortunately I can't throw all the layers in a group and use a group mask in this case since the layers that I want to share the mask must be in different group folders. (I am using actions to export the results of each group to the different flattened files.) So I have similar but not identical layers in separate groups that I would like to share one authored mask. I also can't use smart objects because the layers are not identical.
Is there any way to create a thicker line stroke to the border of the object without tracing the object manually. The object in placed in a group and it has closed and unclosed paths.
I have pictures that have different objects over a canvas like/un uniform back ground.
I need to remove that background without any part of the objects them self.
I mange to get most of the background out using the magic wand , but i'm left with many random single/groups of noise pixels left in the picture since they were not captured with the magic wand.
most of the time i can remove those using the eraser or use the selection tools with different shapes around the pixels and press delete.
but those methods take lots of time, specially around a complex objects and as i'm getting near to them, i need to make my selections/eraser radius smaller and smaller.
I have tried to use a plugin called "Reduce Noise" that i found , but it does not work.
faster way how to remove this noise pixels without any part of the objects?
a plugin that "scans" the image/selected area and remove all pixels that are surrounded by transparency in it?
p.s I can't always select only the object/s itself/them self and just move it/them to a new picture.
p.s.2 maybe a plugin that the user can choose up to what size, a group of pixels, should be removed ?
What if for some reason a person wants to actually make an XML file and stick some <![CDATA[]]> in it? I looked through some manuals & OMV fairly quickly to discover no methods for that. Was wondering if there was some technique.And, just as pointed out in the indesign forums, a string of "]]>" makes the script hang up and debugging have to be stopped with the final message "Cannot execute".
Is there a way to create an object/group in Illustrator and then copy it across one document in multiple places (multiple art boards, etc.) - allowing the designer to then update the original and seeing the changes cascade to all copies?
I know this can be done using InDesign by linking an Illustrator file and making subsequent updates to that Illustrator file. But I do not want to use InDesign, I want to use Illustrator. What I want is much like creating Symbols in Flash, updating one will cascade throughout the file.
I am writing a script for Illustrator. I created a palette with some buttons. I like to keep the palette open while working in Illustrator. The problem is, that the buttons don't work. For example, I have a delete button that should delete my active selection. When I change the Window Type from palette to dialog everything works correctly.
var w = new Window ("palette"); w.orientation = "row"; w.text = "Path Transform"; var f = File ("/C/icons/corner-tr.png"); var corner_tr = w.add ("iconbutton", undefined, f ); var corner_tl = w.add ("iconbutton", undefined, f ); var corner_br = w.add ("iconbutton", undefined, f ); var corner_bl = w.add ("iconbutton", undefined, f ); corner_tr.onClick = function () { selectedObject[0].remove(); createLines(); }