Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepy
# Simple script to test interface to AWRDE
import win32com.client
awrde = win32com.client.Dispatch('AWR.MWOffice')  # connect to AWRDE, latest installed  

It will invoice connect to the most recent version of the AWR Design Environment Installedinstalled, said another way, the version of the last AWR Design Environment Installer run.   

To call a specific version, you will add the major version number such as:

Code Block
languagepy
# Simple script to test interface to AWRDE
import win32com.client
awrde = win32com.client.Dispatch('AWR.MWOffice.13.0')  # connect to AWRDE version 13.0

If you have multiple instances of the AWR Design Environment running at the same time, you can follow the following procedure on how to pick which instance to connect. 

First, in the AWR Design Environment, you need to go into the VB scripting and run

Code Block
languagevb
 Sub Main
   Debug.Print MWOffice.InstanceCLSID
End Sub
     

to get the CLSID of the instance you want to connect to. This will be something like:

62F49D56-070F-4E6C-8AB9-25845CB94B9A

Then, from within python, you use:

Code Block
languagepy
import win32com.client
obj = win32com.client.Dispatch("{CLSID}")


where you replace CLSID with the id you want to use.

For example

Code Block
languagepy
import win32com.client
obj2 = win32com.client.Dispatch("{62F49D56-070F-4E6C-8AB9-25845CB94B9A}")


Note the braces are required.