General XMetaL Discussion
XMetaL Community Forum › General XMetaL Discussion › Macro code having no effect
-
jmarkp August 2, 2011 at 12:22 pm
Macro code having no effect
August 2, 2011 at 12:22 pmParticipants 0Replies 1Last Activity 11 years agoWe'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:
[code]
[/code]
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”);
]]>Interestingly, if I rename Alert to Alrt no error message gets thrown, but if I remove the [code]var ActiveDocument = new ActiveXObject(“XMWrap.XMActiveDocument”);[/code] line above it I do get a 'null object' error.
jmarkp August 2, 2011 at 2:01 pm
Reply to: Macro code having no effect
August 2, 2011 at 2:01 pmMore information from more digging.
If I compile the On_Document_Before_DropText script into an XAC using XMetal Developer in Visual Studio then the script gets run. It's when I just add it manually to the MCR file that it doesn't get run. Very strange…
This seems to have solved my problem, thank goodness 🙂
Mark
-
AuthorPosts
- You must be logged in to reply to this topic.