pyautoit

raw JSON →
0.6.5 verified Mon Apr 27 auth: no python maintenance

Python binding for AutoItX3.dll, enabling automation of Windows GUI interactions. Current version 0.6.5. Released infrequently; last update in 2020.

pip install pyautoit
error ImportError: DLL load failed while importing autoit: The specified module could not be found.
cause AutoItX3.dll is not registered or not in PATH.
fix
Install AutoIt and run 'regsvr32 AutoItX3.dll' as administrator, or copy the DLL to system32.
error AttributeError: module 'autoit' has no attribute 'run'
cause Using 'from pyautoit import autoit' results in importing the package's __init__.py instead of the autoit module.
fix
Use 'import autoit' directly; it is the correct module.
error OSError: [WinError 193] %1 is not a valid Win32 application
cause Running 64-bit Python with a 32-bit DLL. pyautoit only supports 32-bit Python.
fix
Switch to a 32-bit Python interpreter (e.g., C:\Python32\python.exe).
breaking pyautoit requires the AutoItX3.dll to be installed on the system. The DLL is not bundled; you must install AutoIt or AutoItX separately. Without it, import will fail silently or raise a RuntimeError.
fix Download and install AutoIt from https://www.autoitscript.com/site/autoit/downloads/. Ensure AutoItX3.dll is registered (or use regsvr32).
gotcha Function names differ slightly from AutoIt VBA. For example, use 'win_wait_active' instead of 'WinWaitActive'. Case-insensitive but underscores matter.
fix Refer to the official pyautoit documentation or source code for exact function signatures.
gotcha The library is 32-bit only. On 64-bit Python, loading AutoItX3.dll may fail with a 'BadDll' error. You must use 32-bit Python.
fix Install a 32-bit version of Python (e.g., from python.org) and ensure dependencies are 32-bit.
deprecated The project has not been updated since 2020. It may not work with newer AutoIt versions or Python 3.10+ due to potential changes in ctypes or DLL handling.
fix Consider alternatives like pywinauto or use the AutoItX COM interface directly via win32com.

Open Notepad, write text, and close the window.

import autoit

# Launch Notepad
autoit.run("notepad.exe")
autoit.win_wait_active("Untitled - Notepad", 5)

# Send text
autoit.send("Hello, world!", 0)

# Click the 'X' button to close
autoit.win_close("Untitled - Notepad")