Page tree
Skip to end of metadata
Go to start of metadata


Yes, Active State Perl , the standard implementation for windows, includes a module called Win32::OLE which allows Perl scripts to interact with COM components. Using this module you can create an instance of the AWR Design Environment and program the API objects exposed by that instance.

  • First download the current release, from the Active State web site , it comes packaged complete with an installer so setting it up is easy.

  • Double click the MSI to start the installer.

  • At the end of the installation, it will ask to register the extension and add the Perl.exe to the environment path. Approve this as it will make creating and running scripts easier.

    • Registering the ".pl" Perl extension makes it so scripts can be run directly without having to say Perl.exe <scriptfile>.pl. Instead you can just enter the name of the script file and Perl will be invoked.

    • Adding it the environment path means it can be run from anywhere without having to be invoked through a shortcut or navigating to the Perl.exe application.

Here is an example script which invokes the AWR Deign Environment, Creates a new Project, and adds an MLIN element.

#!perl use Win32::OLE

use strict;
use Win32::OLE qw(in with);
use Win32::OLE::Const 'AWR Design Environment 2007';

my $mwo = Win32::OLE->new('AWR.MWOffice', sub {}) or die "MWOffice Application cannot start";

# Create a new project

# Create a new Schematic called 'MySchematic'
my $p = $mwo->Project;
my $s = $p->Schematics->Add('MySchematic');

# Add an element to the schematic
my $e = $s->Elements->Add('MLIN', 0, 0);

The Active State web site also includes a FAQ on using OLE with Perl. The FAQ includes a number of examples of using Perl to control Microsoft Office Applications. Using Perl to interact with both would enable the creation of interesting applications like an automated design review package generator or using Excel to chart data extracted from simulations in Microwave Office.


' VBScript to create MWOffice application object, add a schematic and elements.

Dim objMWO
Dim schem
Dim elem1, elem2

' Create the MWOffice Application object. (Starts the exe)

Set objMWO = CreateObject("AWR.MWOffice")

' Make sure the project is new.


' Add a schematic named "MySchematic"

Set schem = objMWO.Project.Schematics.Add("MySchematic")

' Add some elements.
Set elem1 = schem.Elements.Add("MLIN", 0, 0)
Set elem2 = schem.Elements.Add("MLIN", 0, 0, 180)

MsgBox("Element Count = " & schem.Elements.Count)
  • No labels