//this dxl tries to activate an ole using the word application Object o1 = current string sAttr = "Object Text" //check to see if there is more than one ole in object int iNumberOfOles = oleCount(o1.sAttr) if (iNumberOfOles == 0 || iNumberOfOles > 1) { print "Number of OLEs is " iNumberOfOles "\n" "Must be only 1\n" halt } //check to see if ole is static or unregistered bool bIsStatic = containsStaticOle(o1.sAttr) //this function is not in the dxl help bool bIsUnregistered = containsUnregisteredOle(o1.sAttr) //this function is not in the dxl help if (bIsStatic || bIsUnregistered) { //bIsActivated = false string sError = "Unable to activate OLE: " if (bIsStatic){ sError = sError "It is Static.\n" } else { sError = sError " It is Unregistered.\n" } print sError "" halt } //Try to activate the ole //This uses an undocumented dxl command, it will launch the application instead of being inline if (oleOpen(o1) == false) { print "Error in activating OLE.\n" halt } //OLE is activated now, so go get the automation interface object OleAutoObj objDoc = oleGetAutoObject(o1) if (null objDoc) { //Something is wrong getting OLE handle print "Error getting document handle.\n" oleCloseAutoObject (objDoc) oleDeactivate(o1) halt } //got automation interface handle okay //Go fetch the application to use of the OLE OleAutoObj objApp = null oleGet(objDoc, "Application", objApp) if (null objApp) { //no application defined for OLE oleCloseAutoObject (objApp) oleCloseAutoObject (objDoc) oleDeactivate(o1) print "No application defined for OLE.\n" halt } //Get application name for OLE string sName oleGet(objApp, "Name", sName) //Check if ole application is word if (matches("Word", sName)) { ack "Success! Activated word application for OLE, now do something with it here!\n" } else { print "Some other application is used for this OLE.\n" } //clean up oleCloseAutoObject (objDoc) oleDeactivate(o1)