Pure Python COM package for Windows COM automation and interoperability
88
Build a Python utility that automates interactions with Windows shell components by creating and controlling COM objects. The utility focuses on creating COM objects and accessing their properties.
Implement a module that provides the following functionality:
The module should handle errors gracefully when COM objects cannot be created or accessed.
@generates
def create_shell_object():
"""
Create and return a new Windows Shell Application COM object.
Returns:
COM object representing Shell.Application
Raises:
RuntimeError: If the COM object cannot be created
"""
pass
def get_active_shell_object():
"""
Connect to an already-running Windows Shell Application COM object.
Returns:
COM object representing active Shell.Application, or None if not found
"""
pass
def browse_folder(shell_obj, folder_id):
"""
Browse to a special shell folder using the shell object.
Args:
shell_obj: Shell.Application COM object
folder_id: Integer identifying the special folder (e.g., 0 for Desktop)
Returns:
Folder COM object representing the browsed folder
Raises:
RuntimeError: If folder cannot be accessed
"""
pass
def get_folder_title(folder_obj):
"""
Get the title of a shell folder object.
Args:
folder_obj: Folder COM object
Returns:
String containing the folder title
"""
passProvides COM interoperability for Windows automation.
Install with Tessl CLI
npx tessl i tessl/pypi-comtypesevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10