February 26, 2000 - Opening Applications from JavaScript | WebReference

February 26, 2000 - Opening Applications from JavaScript

Yehuda Shiran February 26, 2000
Opening Applications from JavaScript
Tips: February 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

The ActiveXObject() constructor function creates an instance of an OLE Automation (ActiveX) object. Once an object is created, you refer to it in code using the object variable you defined. If an instance of the ActiveX object is already running, ActiveXObject() may start a new instance when it creates an object of the required type. The following code segment lets the user open a Word document directly:

var pause = 0;
var wdDialogFileOpen = 80;
var wdApp = new ActiveXObject("Word.Application");
var dialog = wdApp.Dialogs(wdDialogFileOpen);
var button = dialog.Show(pause);

The preceding code segment references the Word.Application object, and its methods are used later. Notice the hierarchical structure, where one method or property is actually an object that has its own methods and properties.

Learn more about activating applications from JavaScript in Column 55, OLE Automation in JavaScript.