Using AutoIT with Python

From PeformIQ Upgrade
Jump to navigation Jump to search

Some Links


Sample Scripts

import time

from win32com.client import Dispatch

Auto = Dispatch("AutoItX3.Control")

Auto.Run("calc.exe")
Auto.Run("notepad.exe")

time.sleep(2)

title = 'Untitled'

Auto.WinActivate(title, '')

Auto.Send("AZERTYUIOP = ")

time.sleep(1)

title = 'Calculator'

Auto.WinActivate(title, '')

time.sleep(1)
Auto.Send("12345")

time.sleep(0.4)
Auto.Send("{+}")

time.sleep(0.4)
Auto.Send("54321")

time.sleep(0.4)
Auto.Send("{=}")

time.sleep(0.4)
Auto.Send("^c")

time.sleep(1)

Auto.WinClose(title , '')

title = 'Untitled'
Auto.WinActivate(title, '')
Auto.WinClose(title , '')

Auto.Send("^v")
Auto.Send("{ENTER}")