Description of the problem

How to automate measurements with DewesoftX using Python?


Description of the solution

With the attached Python script we will demonstrate how to load a setup file and record multiple measurements one after the other.


Firstly, you will need a Python IDE/Interpreter installed. You can download it on the Microsoft Store.


Secondly, Python has the “Python for Windows Extensions” package known as pywin32 that allows us to easily access Windows Component Object Model (COM) and control Microsoft applications via Python. To install the pywin32 extension use the Command Prompt using the pip install pywin32 command as below:



With Python, it’s possible to control opening, recording, storing, saving, closing DewesoftX and more.


In the first three rows the modules are loaded:

import sys -> Provides access to some variables used or maintained by the interpreter

from win32com.client import Dispatch -> Creates a Dispatch based COM object

import time -> This module provides various functions to manipulate time values.


A new DCOM object dw is created with the command:

dw = Dispatch("Dewesoft.App")


To open Dewesoft, we call Init() and turn on Enable and Visible to show the software as below.

dw.Init()

dw.Enabled = 1

dw.Visible = 1


In our example we will load two setup files and record two data files for each setup. For this two variables need to be created, setup list and file name suffix list.


The file names will be defined based on the setup files using the split and replace commands.


We can see the result with the gif below :


We can see here that the files are created, and the names allow us to recognize them easily according to the tests carried out.



Additional information

Adding Start/Stop Storing trigger condition using DCOM, Python example of Dewesoft NET




Damien Lajarrige, 28.07.2022