Reply to: Application.CancelOpenDocument not workingApril 3, 2014 at 12:12 am
We've had a discussion here and made some assumptions and we think we know what your issue is.
If you are running a newer version of XMetaL Author Essential or XMetaL Author Enterprise it includes some common code libraries (internally called the XMDK and included starting around the 6.0 release). The XMDK (which is undocumented) takes over the On_Application_Before_Document_Open macro. You could disable the XMDK but it is used by the DITA authoring functionality and some other features so it best not to do that.
We are looking into what it might take to make the XMDK cooperate nicely with your code as written, but in the meantime you can ignore what the documentation in the Programmers Guide says and implement something (also undocumented) called an XMOpenRedirector object, basically injecting your own code into the XMDK so that it will also run.
For this to work your code will need to be rewritten in JScript. We've rewritten the code you posted here as an example. You'll need to make sure that your “getPlugin” object is defined and I'm not sure if this will work with it as we have not seen that code.
SozDokOpenRedirector.prototype.parent = XMOpenRedirector.prototype; function SozDokOpenRedirector ()
SozDokOpenRedirector.prototype.isNeeded = function(xmlFileURI)
Application.Alert(“SozDokOpenRedirector::isNeeded:” + xmlFileURI); // Check for zip file types that we handle…returning true
// will cause our “doOpen()” method below to be called…
return true; // Leave this file for another redirector to handle
SozDokOpenRedirector.prototype.doOpen = function(xmlFileURI, viewMode, CRLocator, isReadOnly, info)
// Cancel open of zip file and let our plugin handle it…
Application.CancelOpenDocument = true;