<html><head></head><body><div class="ydpbd9d34bdyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div></div>
        <div dir="ltr" data-setdir="false">Hi,</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">thanks for explaining the issue with clsids.<br></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">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) <a href="https://gist.github.com/riverar/085d98ffb1343e92225a10817109b2e3#file-quiethours_example-cpp-L23" class="">demonstrates</a>. It just doesn't work with pywin32.<br></div><div><br></div><div dir="ltr" data-setdir="false">When I look for "<span><span style="font-size:10.0pt;font-family:sans-serif;">6bff4732-81ec-4ffb-ae67-b6c1bc29631f</span></span>" in the Windows registry, I only find an entry in <span>"HKEY_CLASSES_ROOT\Interface" (there is no entry in <span>HKEY_CLASSES_ROOT\clsid) </span>with a default value of</span>  "<span>IQuietHoursSettings". But <span>win32com.client.Dispatch('IQuietHoursSettings') fails with the error message </span>"<span>Invalid class string".</span></span></div><div dir="ltr" data-setdir="false"><span><span><br></span></span></div><div dir="ltr" data-setdir="false"><span><span>Best regards!</span></span></div><div dir="ltr" data-setdir="false"><span><span><br></span></span></div><div><br></div>
        
        </div><div id="ydp1f46b9c1yahoo_quoted_5739963694" class="ydp1f46b9c1yahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    On Tuesday, May 30, 2023 at 11:41:25 PM GMT+2, Steven Manross <steven@manross.net> wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div id="ydp1f46b9c1yiv6555864753"><div>
<div class="ydp1f46b9c1yiv6555864753WordSection1">
<p class="ydp1f46b9c1yiv6555864753MsoNormal">While I haven’t worked on exactly what you are working on:</p> 
<p class="ydp1f46b9c1yiv6555864753MsoNormal">  </p> 
<p class="ydp1f46b9c1yiv6555864753MsoNormal">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???).</p> 
<p class="ydp1f46b9c1yiv6555864753MsoNormal">  </p> 
<p class="ydp1f46b9c1yiv6555864753MsoNormal">Classes are listed in the registry here:</p> 
<p class="ydp1f46b9c1yiv6555864753MsoNormal">  </p> 
<p class="ydp1f46b9c1yiv6555864753MsoNormal">HKEY_CLASSES_ROOT\clsid\<span style="font-size:10.0pt;font-family:sans-serif;">{6bff4732-81ec-4ffb-ae67-b6c1bc29631f}<br clear="none">
<br clear="none">
… 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.</span></p> 
<p class="ydp1f46b9c1yiv6555864753MsoNormal">  </p> 
<p class="ydp1f46b9c1yiv6555864753MsoNormal">Here is an example that should work on your system…</p> 
<p class="ydp1f46b9c1yiv6555864753MsoNormal">  </p> 
<p class="ydp1f46b9c1yiv6555864753MsoNormal">ms_dict = win32com.client.Dispatch('Scripting.Dictionary')</p> 
<p class="ydp1f46b9c1yiv6555864753MsoNormal">  </p> 
<p class="ydp1f46b9c1yiv6555864753MsoNormal">… because the scripting dictionary object class is installed in just about every Windows OS since pre-WindowsXP</p> 
<p class="ydp1f46b9c1yiv6555864753MsoNormal">  </p> 
<p class="ydp1f46b9c1yiv6555864753MsoNormal">I hope this helps.  Enjoy your day.</p> 
<p class="ydp1f46b9c1yiv6555864753MsoNormal">  </p> 
<p class="ydp1f46b9c1yiv6555864753MsoNormal">Steven</p> 
<div id="ydp1f46b9c1yiv6555864753yqt51323" class="ydp1f46b9c1yiv6555864753yqt2320242518"><div>
<div style="border-color: rgb(225, 225, 225) currentcolor currentcolor; border-style: solid none none; border-width: 1pt medium medium; padding: 3pt 0in 0in;">
<p class="ydp1f46b9c1yiv6555864753MsoNormal"><b>From:</b> python-win32 <python-win32-bounces+steven=manross.net@python.org>
<b>On Behalf Of </b>name zero via python-win32<br clear="none">
<b>Sent:</b> Monday, May 29, 2023 6:02 AM<br clear="none">
<b>To:</b> python-win32@python.org<br clear="none">
<b>Subject:</b> [python-win32] Setting Focus Assist Mode via COM</p> 
</div>
</div>
<p class="ydp1f46b9c1yiv6555864753MsoNormal">  </p> 
<div>
<div>
<p class="ydp1f46b9c1yiv6555864753MsoNormal"><span style="font-size:10.0pt;font-family:sans-serif;">Hi,</span></p> 
</div>
<div>
<p class="ydp1f46b9c1yiv6555864753MsoNormal"><span style="font-size:10.0pt;font-family:sans-serif;">  </span></p> 
</div>
<div>
<p class="ydp1f46b9c1yiv6555864753MsoNormal"><span style="font-size:10.0pt;font-family:sans-serif;">could someone help me out with first steps for how to set Focus Assist via COM, which
<a shape="rect" href="https://gist.github.com/riverar/085d98ffb1343e92225a10817109b2e3" rel="nofollow" target="_blank">
https://gist.github.com/riverar/085d98ffb1343e92225a10817109b2e3</a> demonstrates for a C++ code base? Something like</span></p> 
</div>
<div>
<p class="ydp1f46b9c1yiv6555864753MsoNormal"><span style="font-size:10.0pt;font-family:sans-serif;">  </span></p> 
</div>
<div>
<p class="ydp1f46b9c1yiv6555864753MsoNormal"><span style="font-size:10.0pt;font-family:sans-serif;">win32com.client.Dispatch('{6bff4732-81ec-4ffb-ae67-b6c1bc29631f}', clsctx=pythoncom.CLSCTX_LOCAL_SERVER)</span></p> 
</div>
<div>
<p class="ydp1f46b9c1yiv6555864753MsoNormal"><span style="font-size:10.0pt;font-family:sans-serif;">  </span></p> 
</div>
<div>
<p class="ydp1f46b9c1yiv6555864753MsoNormal"><span style="font-size:10.0pt;font-family:sans-serif;">fails with "pywintypes.com_error: (-2147221164, 'Class not registered', None, None)"</span></p> 
</div>
<div>
<p class="ydp1f46b9c1yiv6555864753MsoNormal"><span style="font-size:10.0pt;font-family:sans-serif;">  </span></p> 
</div>
<div>
<p class="ydp1f46b9c1yiv6555864753MsoNormal"><span style="font-size:10.0pt;font-family:sans-serif;">Thank you and best regards!</span></p> 
</div>
</div></div>
</div>
</div></div></div>
            </div>
        </div></body></html>