[python-win32] Setting Focus Assist Mode via COM

name zero namezero911 at yahoo.com
Wed May 31 01:31:46 EDT 2023


 Hi,
thanks for explaining the issue with clsids.

The "application" is basically part of MS Windows. Talking to it via COM is 100% possible, as the C++ code (that is part of the GitHub-Gist) demonstrates. It just doesn't work with pywin32.

When I look for "6bff4732-81ec-4ffb-ae67-b6c1bc29631f" in the Windows registry, I only find an entry in "HKEY_CLASSES_ROOT\Interface" (there is no entry in HKEY_CLASSES_ROOT\clsid) with a default value of  "IQuietHoursSettings". But win32com.client.Dispatch('IQuietHoursSettings') fails with the error message "Invalid class string".
Best regards!

    On Tuesday, May 30, 2023 at 11:41:25 PM GMT+2, Steven Manross <steven at manross.net> wrote:  
 
 
While I haven’t worked on exactly what you are working on:
 
  
 
I’d first verify suggest that the application that installs this class needs to be installed on the PC you are trying to create the automation from, because “Class not Registered” isn’t a python error, and it talks more directly to the fact that the appropriate class from the software you are trying to automate isn’t on the computer you are running python from: so either you have the wrong CLSID or are doing something else wrong (missing software???).
 
  
 
Classes are listed in the registry here:
 
  
 
HKEY_CLASSES_ROOT\clsid\{6bff4732-81ec-4ffb-ae67-b6c1bc29631f}

… and your CLSID would need to exist (as installed from whatever software you are trying to automate) prior to python being able to automate it.
 
  
 
Here is an example that should work on your system…
 
  
 
ms_dict = win32com.client.Dispatch('Scripting.Dictionary')
 
  
 
… because the scripting dictionary object class is installed in just about every Windows OS since pre-WindowsXP
 
  
 
I hope this helps.  Enjoy your day.
 
  
 
Steven
 
From: python-win32 <python-win32-bounces+steven=manross.net at python.org>On Behalf Of name zero via python-win32
Sent: Monday, May 29, 2023 6:02 AM
To: python-win32 at python.org
Subject: [python-win32] Setting Focus Assist Mode via COM
 
  
 
Hi,
 
  
 
could someone help me out with first steps for how to set Focus Assist via COM, whichhttps://gist.github.com/riverar/085d98ffb1343e92225a10817109b2e3 demonstrates for a C++ code base? Something like
 
  
 
win32com.client.Dispatch('{6bff4732-81ec-4ffb-ae67-b6c1bc29631f}', clsctx=pythoncom.CLSCTX_LOCAL_SERVER)
 
  
 
fails with "pywintypes.com_error: (-2147221164, 'Class not registered', None, None)"
 
  
 
Thank you and best regards!
   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/python-win32/attachments/20230531/d392a180/attachment.html>


More information about the python-win32 mailing list