The Notify event receives four parameters: note, object, sparam, and iparam. For the event you are using, object should be the document object of the FrameMaker document being opened. So, you should be able to use this:
doTheWork(object);
Make sure you update your doTheWork function to receive the Doc object:
function doTheWork(doc) { var flow, root, elemName, mPageAttrib, topicElem, topicElemName, allAttribs; flow = doc.MainFlowInDoc; root = flow.HighestLevelElement; // will always get something even if unstructured document while(root.ObjectValid()) { //only do something for structured docs elemName = getElementName(root); ...more code to do stuff.... }
}
-Rick