Jump to content
Sign in to follow this  
Alias

Newbie ControlClick() Issues

Recommended Posts

Alias

I am working on a simple script to simply log into a user defined Tournement (PokerStars) and I am noticing some behaviour from ControlClick() that is really messing me up.

If the button that I want to click on is not visible OR is grayed out ControlClick is still clicking it somehow, it is messing up my if statements.

Is there a better way to do this? P.S. PokerStars doesn't give out much info for the AutoIt Window Info Tool.

Thanks to anyone that can help.

If WinWaitActive("Tournament Registration") then

If ControlClick("Tournament Registration", "OK","[CLASS:Button; INSTANCE:2]") Then
msgbox(64, "Info", "The 'OK' button has been clicked",4)
Sleep (4000)
Else
MsgBox(64,"Info", "The 'OK' button isn't active", 4)
Sleep (4000)
Endif

Endif
Edited by Alias

Share this post


Link to post
Share on other sites
azure

If WinWaitActive("Tournament Registration") then
     If ControlCommand("Tournament Registration","OK","[CLASS:Button; INSTANCE:2]","IsVisible","") AND ControlCommand("Tournament Registration","OK","[CLASS:Button; INSTANCE:2]","IsEnabled","") Then
          ControlClick("Tournament Registration", "OK","[CLASS:Button; INSTANCE:2]")
          msgbox(64, "Info", "The 'OK' button has been clicked",4)
          Sleep (4000)
     Else
          MsgBox(64,"Info", "The 'OK' button isn't active", 4)
          Sleep (4000)
     Endif

Endif

Try this?

Share this post


Link to post
Share on other sites
Alias

Thanks for the quick response azure, that worked perfectly!

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  

×