Reputation: 886
I am new to using AutoIt, and I am trying to use it to automatically click buttons on Windows programs. I have been able to access some functions using import win32com.client
and win32com.client.Dispatch("AutoItX3.Control")
.
But I am wondering if anyone knows of another way of doing this without downloading something else. The thing is, I had to download Pywin32 to do this. Is there something within the native Python libraries that can use AutoIt or its COMs module to run the functions?
Upvotes: 1
Views: 946
Reputation: 9937
Probably, you can use ctypes. For example, follow code sends message Hello
to active window:
from ctypes import windll
path = r"C:\Program Files\AutoIt3\AutoItX\AutoItX3.dll"
autoit = windll.LoadLibrary(path)
autoit.AU3_Send(u"Hello{!}", 0)
Also, you can run autoit
scripts by using os.system
or subprocess.call
modules.
With os.system
:
import os
os.system(r'lowerchange.au3')
With subprocess.call
:
import subprocess
subprocess.call(['C:\Program Files\AutoIt3\AutoIt3.exe',r'lowerchange.au3'])
Upvotes: 1