win32com.client.Dispatch Class Label

前端 未结 2 711
心在旅途
心在旅途 2021-01-23 01:34

I am trying to connect to a COM object using python.

More specifically, I am using ASCOM standard drivers to connect to a MaxDome II, and do not know how to reference t

2条回答
  •  半阙折子戏
    2021-01-23 02:09

    I do not think it is possible to get the list of COM objects directly from python, however you can run the following code (and indeed run it from inside python) in Powershell:

    Get-ChildItem HKLM:\Software\Classes -ErrorAction SilentlyContinue | Where-Object {
       $_.PSChildName -match '^\w+\.\w+$' -and (Test-Path -Path "$($_.PSPath)\CLSID")
    } | Select-Object -ExpandProperty PSChildName
    

    This will output a list of all valid names of COM objects on your system sorted alphabetically, and the syntax is normally MainProgram.SubFunction.

    Some of the output on my machine:

    I hope this helps!

提交回复
热议问题