cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Access Arbortext Editor in an ActiveX control

RomanHalstenber
1-Newbie

Access Arbortext Editor in an ActiveX control

I've embedded Arbortext Editor 5.4 in an ActiveX control in an HTML page as described in the Customizer's Guide (p. 183) and in samles/web-integration/embedded_scripting.html.

My question is, how to get access to the AOM/DOM of a document loaded in the ActiveX control from the HTML page embedding the Arbortext Editor control using JavaScript/JScript?

Here is the relevant part of my HTML page:

...
<object id="editor" classid="clsid:3990811F-C23D-448E-B893-54549C334960"
height="100%" width="100%">
<script language="javascript" type="text/javascript" for="editor">
var documentFlags = 0x0000;
var windowFlags = 0x949FF;
var aclWindowId;
function OpenDoc(docUrl)
{
aclWindowId = editor.open(docUrl, documentFlags, windowFlags);
}
</script>
...

What should I do now with the window id returned by the open method to access the AOM/DOM?

Any help will be appreciated.

Roman

1 REPLY 1

I've received an answer from PTC support in the meantime which solves my problem. The point is that you have to instantiate the editor first with new ActiveXObject("Epic.Application"). Another important issue is to have proper, which means relaxed, ActiveX security settings in IE.


<script language="javascript" type="text/javascript" for="editor">

var application;
var appWindow;
var appDocument;

// This instantiates the Editor "application" object so it can be used later.
try
{
application = new ActiveXObject("Epic.Application");
}
catch (e)
{
alert(e.message);
}


var documentFlags = 0x0000;
var windowFlags = 0x949FF;
var aclWindowId;
var domDocument;
function OpenDoc(docUrl)
{
try
{
aclWindowId = editor.open(docUrl, documentFlags, windowFlags);

// Use the aclWindowId to gain access to the object model window and document objects.
appWindow = application.Acl.getWindow(aclWindowId);
appDocument = appWindow.activeView.document;

// Construct a message with some information from the window and document.
var message = "Window Width = " + appWindow.width;
message += ", Window Height = " + appWindow.height;
message += ", Window Left X = " + appWindow.screenX;
message += ", Window Left Y = " + appWindow.screenY;

message += "\n\nDocument Element = " + appDocument.documentElement.localName;
message += ", Document Element Child= " + appDocument.documentElement.firstChild.localName;


alert(message);
}
catch (e)
{
alert(e.message);
}
}

...

</script>

Top Tags