Jump to content

ControlClick doesn't work


Trevons
 Share

Recommended Posts

ok, so, using my tiny waitforcontrols udf and a logger i proved it DOES work. you can just download the attached files. This is the rough outline for how you can start, you can do button clicks all day long. Yes there are extra contstants you don't need at the moment but it serves as an example of how to write a proper installer automater script that dynamically waits. study the code in WaitForControls.au3. that is the heart of it.

 

You WILL need to run as admin as well to install anything these days

#include <Timers.au3>
#include <GUIConstantsEx.au3>
#include "WaitForControls.au3"
#include "log4a.au3"

#RequireAdmin

#Region ;**** Logging ****
; Enable logging and don't write to stderr
_log4a_SetEnable()
; Write to stderr, set min level to warn, customize message format
_log4a_SetErrorStream()

_log4a_SetMinLevel($LOG4A_LEVEL_TRACE)
; If @compiled Then _log4a_SetMinLevel($LOG4A_LEVEL_WARN) ; Change the min level if the script is compiled
_log4a_SetFormat("${date} | ${host} | ${level} | ${message}")
#EndRegion ;**** Logging ****

Const $TD_BTN_NEXT = '&Next >'
Const $TD_BTN_INSTALL = '&Install'
Const $TD_BTN_CANCEL = 'Cancel'
Const $TD_BTN_FINISH = 'Finish'
Const $TD_BTN_UNINSTALL = '&Uninstall'
Const $TD_BTN_CLOSE = 'Close'
Const $TD_BTN_YES = '&Yes'
Const $TD_CBO_LANG = 'English'


Const $formclass = "[CLASS:#32770]"
Const $Edit =   "[CLASS:Edit; INSTANCE:1]"
Const $button1 = "[CLASS:Button; INSTANCE:1]"
Const $button2 = "[CLASS:Button; INSTANCE:2]"
Const $button3 = "[CLASS:Button; INSTANCE:3]"
Const $cbolanguage = "[CLASS:ComboBox; INSTANCE:1]"
Const $langInst = 'Installer Language'

instNotepad()

Func instNotepad()
    _log4a_Info('instNotepad:Begin')
    _CheckClickCtrl($formclass, $langInst, $cbolanguage, $TD_CBO_LANG, 0, 0)
    _log4a_Info('instNotepad():End')
EndFunc   ;==>instNotepad

 

Capture.thumb.PNG.0b55e6e92db45d91835c7d2b2e666c64.PNG

WaitForControls.au3 log4a.au3

instNotepad.au3

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

you will have to probably change the Language Name to what it defaults to in your country. But, it DOES work. You can just add calls to _CheckClickControl  function and click on cbo and buttons all day long with no static waits, and you can specify a timeout (no timeout is default when you call that function, it will basically loop forever looking for it--timeouts are rarely needed)

 

here is the logs to prove it too

Quote

08\12\2020 15:45:10 | WIN10X64TESTVM | Info | instNotepad:Begin
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | _checkClickCtrl():Begin
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | Searching for Formclass: [CLASS:#32770]
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | Searching for Text: Installer Language
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | Searching for Control: [CLASS:ComboBox; INSTANCE:1]
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | Searching for Ctrl Txt: English
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | Timeout: 0
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | Time Delay (after click): 0
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | Control Text Search: English
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | Control Text Found: English
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | Found Formclass: [CLASS:#32770]
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | Found Text: Installer Language
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | Found Control: [CLASS:ComboBox; INSTANCE:1]
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | Found Ctrl Txt: English
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | Timeout: 0
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | Time Delay (after click): 0
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | [CLASS:ComboBox; INSTANCE:1]
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | ExitLoop:Normal - [CLASS:ComboBox; INSTANCE:1]
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | _checkClickCtrl():End
08\12\2020 15:45:10 | WIN10X64TESTVM | Info | instNotepad():End
 

 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...