General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion xft form – Getting ActiveDocument is undefined

  • russurquhart1

    xft form – Getting ActiveDocument is undefined

    Participants 2
    Replies 3
    Last Activity 8 years, 4 months ago

    Hi,

    I'm trying to debug someone else's code. They have the following macro:

    // Note must be in tags on view for this to work.
    nonmodalDlg = null;
          var XftCtrl = new ActiveXObject(“XF.XFTForm”);
          nonmodalDlg = XftCtrl.StartForm(“C:\Doczone\Forms\xRefErrs.xft”, 0);
    ]]>

    When they go to run it, and i can duplicate this, they get a dialog with stating the ActiveDocument is undefined.

    I've never used this, and didn't write this, but am pretty sure it did work at one time. Can anyone suggest what i should check to look at this?

    thanks,

    Russ

    Reply

    Derek Read

    Reply to: xft form – Getting ActiveDocument is undefined

    I think you will need to look at the code inside the XFT itself to see what's going on.

    Reply

    XMetaLOldTimer

    Reply to: xft form – Getting ActiveDocument is undefined

    This macro is using the “advanced” way of running an XFT form versus the simply way via Application.CreateFormDlg API.  When using the advance way, you need to inject all top-level objects referenced by the script contained within the .xft form.  The simply way automatically injects Application, ActiveDocument, Selection, Documents, and ResourceManager for you.  Try changing the macro like this:

            var XftCtrl = new ActiveXObject(“XF.XFTForm”);
            XftCtrl.AddTopLevelObject(“ActiveDocument”, ActiveDocument);
            nonmodalDlg = XftCtrl.StartForm(“C:\Doczone\Forms\xRefErrs.xft”, 0);

    Regards,
    Addam

    Reply

    russurquhart1

    Reply to: xft form – Getting ActiveDocument is undefined

    Hi,

    I gave that a shot but, at least on my machine, it didn't make a difference. The issue is that on some machines in our group, this macro is working, on others, like mine, it is not. I can't help but think that this might be a Windows 7/MS Office upgrade issue. But i need to find out more info!

    Thanks for the suggestions.

    Russ

    Reply

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

Lost Your Password?

Products
Downloads
Support