Phaser Posted August 12, 2009 Posted August 12, 2009 Hi everyone I am trying to click 2 specific places on a web page, I am using the google feeling lucky button as my test, if okbutton pressed perform clicks UNTIL cancel button is pressed, if I launch the tool and click cancel, it closes, perfect, if I hit yes then try to cancel it doesn't cancel as the loop has started already, I know about exitloop but cant get it to recognise the cancel button after the loop has started, any ideas? Heres my code #include <GUIConstantsEx.au3> GUICreate("Update tool", 260, 100) GUICtrlCreateLabel("Do you want to start the updating?", 30, 10) $okbutton = GUICtrlCreateButton("Yes", 70, 50, 60) $cancelbutton = GUICtrlCreateButton("Cancel", 140, 50, 60) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $cancelbutton ExitLoop Case $msg = $okbutton while 1 Sleep(2000) MouseClick("left", 1000, 356) Sleep(2000) MouseClick("left", 550, 220) WEnd EndSelect WEnd If someone could correct my code (or show a better way) it would be much appreciated, if there's a quicker way to do what I want please say so. Cheers
Scriptonize Posted August 12, 2009 Posted August 12, 2009 A nearly same question was dropped a few days ago. You need the nested loop to check for a certain value and then let it in your case exit that loop. While 1 Get X value Get Y value If X <> value1 Then While x <> value1 ...do something... Get X value again Wend While y <> value2 ...do (maybe) something (else)... Get Y value again Wend Else ...perhaps do something else if both vars are OK EndIF Wend If you learn from It, it's not a mistake
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