Sg2.9
problems with selectedItems
Recent RSS
problems with selectedItems
Date:  13. June 2006, 13:52

I'm encountering some strange behaviour with selectedItems:

When I select a group of two objects, selectedItems.length returns 3 -> the group, and every object in the group. I would expect selectedItems to return 1.

This is creating problems for me since I want to raster the activeSelection, which means I need to put all the selected items in a new group to raster them into one image.

var ad=activeDocument;
var orSel=ad.selectedItems;
var toRaster = new Group(ad);
ad.activeLayer.append(toRaster);

for(i=0; i<orSel.length; i++){
	toRaster.append(orSel[i]);
}

If this is how selectedItems should work, does anyone maybe know a work around?

Re: problems with selectedItems
From:  Jürg Lehni
Date:  29. September 2006, 21:00

From 2.0.018 on, only objects of which the parent object is not select will be added to the list. This will solve your problem and feels more logical too. Illustrator does it in a different way internally though.

Re: problems with selectedItems
Date:  30. September 2006, 12:55

Great, thanks very much! This will make handling selections _alot_ more logical..
I wonder why Illustrator works this way internally.. For speed?

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Stroke Input 09.03.09