Adding shapes to programatically created layer in js


I just started playing with automation and works great,

One question.

When using js ,given I add a new layer via a script, can i add shapes to that layer? or am i limited to the currently selected layer ( manually in omnigraffle itself)?

Many thanks.