2. If a have the same label on multiple pageItems and select them with app.documents.pageItems.item('test'); i dont get them as an array but as one object of some sort. Is it possible to loop through them?
You can get them as array like so:
This should for CS3/4, but I read on the forum that CS5 works differently with labels.
Bear in mind that if you attempt to use .getElements() to convert the result of a call like:
into an array, you'll get an "Object is invalid" error if there are no such objects.
There are various ways of working around this.