We're hosting the XMAX control (v. 6.0.0.159) via a Windows Form Host in a WPF application and it's mostly working fine.
I'm trying to write a macro to modify the paste behaviour, so I'm using On_Document_Before_DropText
The code is definitely being parsed, because if I introduce a JavaScript syntax error (missing a closing ')') then an error message pops up to that effect when I paste text.
However the code itself doesn't seem to be having any effect. Am I doing anything wrong?
Here's my .mcr file:
<?xml version="1.0" encoding="UTF-16"?>
<!DOCTYPE MACROS SYSTEM "macros.dtd">
<MACROS>
<MACRO name="On_Document_Before_DropText" lang="JScript" hide="false"><![CDATA[
var ActiveDocument = new ActiveXObject("XMWrap.XMActiveDocument");
ActiveDocument.Host.Alert("Your Message Here", "test");
]]></MACRO><MACRO name="On_Macro_File_Load" lang="JScript" desc="Macro executed when the macro file is loaded" hide="false"><![CDATA[// XMetal Author JScript Macro File
var Application = new ActiveXObject("XMWrap.XMApplication");
var Documents = new ActiveXObject("XMWrap.XMDocuments");
var ActiveDocument = new ActiveXObject("XMWrap.XMActiveDocument");
var Selection = new ActiveXObject("XMWrap.XMSelection");
var ResourceManager = new ActiveXObject("XMWrap.XMResourceManager");
]]></MACRO></MACROS>
Interestingly, if I rename Alert to Alrt no error message gets thrown, but if I remove the
var ActiveDocument = new ActiveXObject("XMWrap.XMActiveDocument");
line above it I do get a 'null object' error.