Jump to content

Automatically wait for desired control, then manipulate it


Earthshine
 Share

Recommended Posts

This is pretty useful to me at least, I hope to others. Whenever you need to poke a button or such on a GUI, you can just make calls to this UDF and instruct it how long to wait, 0 is forever, anyway, let the code to the explaining. Feel free to help expand this UDF. I plan to create new ones as I go along that support all the Win32 and .NET Controls. Ultimately, I would like to be able to fully control any type of control, this works well with most. Just an example of what you can do.

NOTE: Logger Author(s) .....: Michael Mims (zorphnog)
;                    the logging script can be obtained here
;                   https://www.autoitscript.com/forum/topic/156196-log4a-a-logging-udf/

 

 

 

 

 

 

 

WaitForControls.au3 log4a.au3

Edited by Earthshine
Updated to match UDF function name

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

This is and example of the output in the console. It will be automatically written to a text file if this file is compiled to exe. The log file will be named the same as the exe with a .log and be present in the same location as the running exe.

Install results:

10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | inst7zinst7z:Begin
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | CheckClickCtrl():Begin
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Waiting for: [CLASS:#32770] 7-Zip 15.14 (x64) Setup [CLASS:Button; INSTANCE:2] &Install
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Timeout: 0
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Control Text : &Install
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Control Text Search : &Install
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | [CLASS:#32770]
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | [CLASS:Button; INSTANCE:2]
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Trace | ExitLoop:Normal - [CLASS:Button; INSTANCE:2]
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | CheckClickCtrl():End
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | CheckClickCtrl():Begin
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Waiting for: [CLASS:#32770] 7-Zip 15.14 (x64) Setup [CLASS:Button; INSTANCE:2] Close
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Timeout: 0
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Control Text : &Install
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Control Text Search : Close
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Control Text : &Install
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Control Text Search : Close
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Control Text : &Install
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Control Text Search : Close
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Control Text : &Install
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Control Text Search : Close
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Control Text : &Install
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Control Text Search : Close
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Control Text : &Install
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Control Text Search : Close
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Control Text : Close
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | Control Text Search : Close
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | [CLASS:#32770]
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | [CLASS:Button; INSTANCE:2]
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Trace | ExitLoop:Normal - [CLASS:Button; INSTANCE:2]
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | CheckClickCtrl():End
10\02\2017 14:32:30 | WIN-4VR4FSF2H8Q | Info | inst7z():End
+>14:32:30 AutoIt3.exe ended.rc:0
+>14:32:30 AutoIt3Wrapper Finish


Uninstall results:
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | unInst7zinst7z:Begin
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | CheckClickCtrl():Begin
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | Waiting for: [CLASS:#32770] 7-Zip 15.14 (x64) Uninstall [CLASS:Button; INSTANCE:1] &Uninstall
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | Timeout: 0
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | Control Text : &Uninstall
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | Control Text Search : &Uninstall
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | [CLASS:#32770]
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | [CLASS:Button; INSTANCE:1]
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Trace | ExitLoop:Normal - [CLASS:Button; INSTANCE:1]
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | CheckClickCtrl():End
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | CheckClickCtrl():Begin
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | Waiting for: [CLASS:#32770] 7-Zip 15.14 (x64) Uninstall [CLASS:Button; INSTANCE:1] Close
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | Timeout: 0
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | Control Text : &Uninstall
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | Control Text Search : Close
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | Control Text : &Uninstall
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | Control Text Search : Close
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | Control Text : &Uninstall
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | Control Text Search : Close
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | Control Text : &Uninstall
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | Control Text Search : Close
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | Control Text : Close
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | Control Text Search : Close
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | [CLASS:#32770]
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | [CLASS:Button; INSTANCE:1]
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Trace | ExitLoop:Normal - [CLASS:Button; INSTANCE:1]
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | CheckClickCtrl():End
10\02\2017 14:35:00 | WIN-4VR4FSF2H8Q | Info | inst7z():End
+>14:35:00 AutoIt3.exe ended.rc:0
+>14:35:00 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 0.7732
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

×
×
  • Create New...