General XMetaL Discussion
XMetaL Community Forum › General XMetaL Discussion › xft form – Getting ActiveDocument is undefined
-
russurquhart1 May 14, 2014 at 3:28 pm
xft form – Getting ActiveDocument is undefined
May 14, 2014 at 3:28 pmParticipants 2Replies 3Last Activity 8 years, 8 months agoHi,
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
Derek Read May 14, 2014 at 5:57 pm
Reply to: xft form – Getting ActiveDocument is undefined
May 14, 2014 at 5:57 pmI think you will need to look at the code inside the XFT itself to see what's going on.
XMetaLOldTimer May 15, 2014 at 8:29 pm
Reply to: xft form – Getting ActiveDocument is undefined
May 15, 2014 at 8:29 pmThis 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,
Addamrussurquhart1 May 21, 2014 at 2:38 pm
Reply to: xft form – Getting ActiveDocument is undefined
May 21, 2014 at 2:38 pmHi,
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
-
AuthorPosts
- You must be logged in to reply to this topic.