Thanks for the reply.
Now that I think about it, I think I got the Illustrator code from another forum,
.
[quote]Also you should consider that Layers that reside in a Group are filial to the Group in DOM, not the Document.[/quote]
I will look into this, thanks! I think I might have to study Photoshop scripts a bit more first...