@sergerdn said in Мне нужно добавить более 500 аккаунтов в клиент Thunderbird. Выручите кто знает, кто делал!:
@niko_belik
Когда-то давно, когда мне надо было автоматизировать программы на Windows, то использовал pywinauto. Так как не было других путей.
С помощью pywinauto можно и самими приложениями BAS управлять.
Задача была проверять скомпилированную программу на ее работоспособность, так и выяснил.
Если кому-то вдруг надо будет, то управляется так:
import asyncio
from pywinauto import Application
async def main(exe_filename: str):
"""
Run the app, perform setup, and wait for it to close.
:param exe_filename: Path to the compiled app executable.
"""
# Start the app with specified backend
app = Application(backend="uia").start(exe_filename)
# Periodically check if the app is running until it has finished downloading dependencies
# and has detached from the console.
while app.is_process_running():
await asyncio.sleep(5)
# Connect to the app window
app = Application(backend="uia").connect(title_re="^PyBasFree", timeout=10)
# Ensure that the application process is running
assert app.is_process_running() is True
# Place for additional setup of the app, e.g. setting configurations.
# TODO: Implement necessary setup here.
# Find the 'OK Enter' button in the app window and click it to start the app.
app.window(title="OK Enter", top_level_only=False).wrapper_object().click()
if __name__ == "__main__":
# Provide the absolute path to the executable and run the main function
exe_path = "C:\\Users\\user\\Desktop\\PyBasFree\\PyBasFree.exe"
asyncio.run(main(exe_filename=exe_path))