Hyflex Posted February 15, 2012 Share Posted February 15, 2012 (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 February 15, 2012 by XxXGoD Link to comment Share on other sites More sharing options...
Thornhunt Posted February 15, 2012 Share Posted February 15, 2012 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 Link to comment Share on other sites More sharing options...
digiworks Posted February 16, 2012 Share Posted February 16, 2012 While 1 If WinExists("HO", "Close the program") Then WinClose("HO", "Close the program") EndIf sleep(100) WEnd Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 16, 2012 Moderators Share Posted February 16, 2012 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 "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 comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now