Reputation: 1625
I have this code so far:
var targetDoc = DocumentApp.getActiveDocument();
var cursor = targetDoc.getCursor().getElement();
var cursorParent = cursor.getParent();
var cursorPoint = cursorParent.getParent().getChildIndex(cursorParent);
But this brings back the child of the cursors parent's parent which is always 0. I cannot find a way to get the childIndex of the cursor's own parent.
Does anyone know how to do this?
Kind Regards.
Upvotes: 0
Views: 696
Reputation: 1625
I was totally over thinking it. I separated out my code from the main function and found this will bring back the index number of the cursor's parent:
var targetDoc = DocumentApp.getActiveDocument();
var cursor = targetDoc.getCursor().getElement();
var cursorParent = cursor.getParent().getChildIndex(cursor);
Logger.log(cursorParent);
Upvotes: 2