How to get the position of a selected node

How do I get the current position of a selected node in the tree? I would like to pass this information out to a script but I can’t figure out how.

What do you mean by “position”?
You can get ID of parent item and index on level as

var id = tree.getSelectedItemId();
var pid = tree.getParentId(id);
var ind = tree.getIndexById(id);