Search code examples
windowsuser-interfaceautoit

Access GUI elements using AutoIt


Is it possible to access elements of a GUI in Windows directly using AutoIt? For example pressing a special button by handle and window title.

Is that possible and if it is, how to do that?


Solution

  • Yes, it is one of main features of AutoIt. But not all window elements can be processed. AutoIt Window Information Tool allows to identify class of window/control:

    enter image description here

    For example type 89+12 in calc.exe:

    run("calc.exe")
    $calc = winwait("Калькулятор")
    ControlClick($calc,"","Button9")
    sleep(500)
    ControlClick($calc,"","Button14")
    sleep(500)
    ControlClick($calc,"","Button23")
    sleep(500)
    ControlClick($calc,"","Button5")
    sleep(500)
    ControlClick($calc,"","Button11")
    sleep(500)
    ControlClick($calc,"","Button28")