Jump to content

Improve a simple loop to control click.

Recommended Posts

I'm looking for the best, safest, most durable and reliable way to press "Close the program" on a popup I keep getting now and again

>> Window <<

Title: HO
Class: #32770

>> Control <<

Class: Button
Instance: 1
ClassnameNN: Button1
Advanced (Class): [CLASS:Button; INSTANCE:1]
Text: Close the program

Handle: 0x025912D2 (WinGetHandle)
Process ID: 6488 (WinGetProcess)
State: 7 (WinGetState)
Text: Close the program (WinGetText)

I would usually just use the macro such as below but am wondering if there is a better/safer/more reliable way of doing it.

While 1

If WinExists("HO", "Close the program") Then

WinWaitActive("HO", "", 5)

If WinActive("HO") Then
ControlClick("HO", "Close the program", "[CLASS:Button; INSTANCE:1]")



Edited by XxXGoD
Link to post
Share on other sites
  • Moderators

Or, if you want to do other things in your script and just have it periodically check for the window..


Func _close()
   If WinExists("HO", "Close the program") Then
      WinClose("HO", "Close the program")

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...