# -*- coding: utf-8 -*- import winreg import pathlib import os readmodule = 0 # 0 - вывести имена 1 - генерация модулей if readmodule == 0: key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, "CLSID", 0, winreg.KEY_READ) info = winreg.QueryInfoKey(key) for i in range(info[0]): # Get the CLSID/GUID subkey_name = winreg.EnumKey(key, i) clsid_key = winreg.OpenKey(key, subkey_name, 0, winreg.KEY_READ) clsid_info = winreg.QueryInfoKey(clsid_key) try: for j in range(clsid_info[0]): nameKey = winreg.EnumKey(clsid_key, j) if "InprocServer32" in nameKey: _key = winreg.OpenKey(clsid_key, nameKey, 0, winreg.KEY_READ) _patchlib = winreg.QueryValue(_key, None) winreg.CloseKey(_key) if "ProgID" in nameKey: _key = winreg.OpenKey(clsid_key, nameKey, 0, winreg.KEY_READ) _progid = winreg.QueryValue(_key, None) winreg.CloseKey(_key) if "TypeLib" in nameKey: _key = winreg.OpenKey(clsid_key, nameKey, 0, winreg.KEY_READ) _TLIBID = winreg.QueryValue(_key, None) winreg.CloseKey(_key) if "Version" in nameKey: _key = winreg.OpenKey(clsid_key, nameKey, 0, winreg.KEY_READ) _version = winreg.QueryValue(_key, None) winreg.CloseKey(_key) # ищем по части пути SOLIDWORKS if "SOLIDWORKS Corp" in _patchlib: print(_patchlib) # print(version_str) print(_progid) print(_TLIBID) print(_version) except: pass winreg.CloseKey(clsid_key) winreg.CloseKey(key) |