Sg2.9
activeDocument.layers["name"]...
Recent RSS
activeDocument.layers["name"].layers["name"]
Date:  2. May 2006, 13:50

Since Illustrator has sublayers, it would be nice to be able to call these with:
activeDocument.layers["name"].layers["name"]

Right now I'm doing the following:

for(var i=0; i<activeDocument.layers.length; i++){
	for(l=0; l<activeDocument.layers[i].children.length; l++){
		if(activeDocument.layers[i].children[l].name=="str"){
			l=activeDocument.layers[i].children.length;
			addTileset(activeDocument.layers[i]);
		}
	}
}

But it would be much handier like:

for(var i=0; i<activeDocument.layers.length; i++){
	if(activeDocument.layers[i].layers["str"]){
		addTileset(activeDocument.layers[i]);
	}
}

Or/and make it possible to point to a child by name, which would be extremely handy also:

activeDocument.layers["Layer 1"].children["childname"]

I hope I have my facts straight on this one!

Re: activeDocument.layers["name"].layers["name"]
Date:  2. May 2006, 14:54

Just to make clear why this would be very handy for me:

I'm working on a tool that makes use of user designed tiles that are basically art objects in layers.

To be able to have multiple Tilesets, I thought it would be a good idea to use sublayers.

So you'll have a layer layout like

(layer) Tiles
	(layer) Tilesetname
		(layer) hor
			(art)horizontal tile
			(art)horizontal tile 2 etc.
		(layer) ver
		(layer) tl
		(layer) tr
		(layer) bl
		(layer) br
		(layer) str
	(layer) Another Tilesetname
		(layer) hor
		(layer) ver
		(layer) tl
		(layer) tr
		(layer) bl
		(layer) br
		(layer) str

I would like to: activeDocument.layers["Tiles"].layers[selectedTileset].layers["hor"].children[index]

It's only a cleaner way, really.

And being able to select the children by name could also be cool.
Right now I'm using the top-most tile, so if you want a different horizontal tile you have to move it to the top of the layer list.
In stead, I could make popuplists with the names of the children.

Anyway, for now I will develop using for-loops to get to the correct sublayers/children.

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
Area Type Resizer 03.08.12