Sign in to follow this  
Followers 0
Hyflex

Improve a simple loop to control click.

4 posts in this topic

#1 ·  Posted (edited)

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

WinActivate("HO")
WinWaitActive("HO", "", 5)

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

EndIf

Sleep(100)

WEnd
Edited by XxXGoD

Share this post


Link to post
Share on other sites



WinClose() ?

any help


Budweiser + room = warm beerwarm beer + fridge = too long!warm beer + CO2 fire extinguisher = Perfect![quote]Protect the easly offended ... BAN EVERYTHING[/quote]^^ hmm works for me :D

Share this post


Link to post
Share on other sites

While 1
   If WinExists("HO", "Close the program") Then
      WinClose("HO", "Close the program")
   EndIf
   sleep(100)
WEnd

Share this post


Link to post
Share on other sites

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

AdlibRegister("_close")

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

√-1 2^3 ∑ π, and it was delicious!

Share this post


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
Sign in to follow this  
Followers 0