2 Basic Usage Overview

The Windows package must be loaded each time a GNU Octave session is started:

pkg load windows

The Windows toolkit provides 2 main types of functionality:

COM Interface functions

These are functions that allow interfacing to COM objects.

Windows Utilities

Functions that provide additional functions for windows

2.1 COM objects

2.1.1 Creating a COM object

To create a COM object, you use the actxserver function with the name of the object to create.

wshell = actxserver ("WScript.Shell");

A octave_com_object type will be returned that provides an interface to the functions and properties of the object.

To get a list of properties for the object, use the get function. Assuming we have the wshell object from the previous example:

get(wshell)

A list of the properties of the object will be displayed.

To get a list of the methods available for the object, use the methods function.

methods(wshell)

2.1.2 Using a COM object

Once a object is created using the actxserver function, and you know the methods and properties available, call the properties of methods using the dot notation.

The following example will display the current directory.

wshell = actxserver ("WScript.Shell");
wshell.CurrentDirectory

Calling functions is performed in the same way.

wshell = actxserver ("WScript.Shell");
wshell.Exec("notepad.exe");

2.1.3 Releasing COM object

A COM object should be released when it is not going to be used anymore to free any resources it may have allowed.

release(wshell);

2.2 Windows Utility functions

A number of utility functions are available. See the reference for their usage.