General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion Macro code having no effect

  • jmarkp

    Macro code having no effect

    Participants 0
    Replies 1
    Last Activity 11 years, 4 months ago

    We're hosting the XMAX control (v. 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:


    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.



    Reply to: Macro code having no effect

    More 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 🙂



  • You must be logged in to reply to this topic.

Lost Your Password?