Jump to content

While 1 Loop, can't seem to get it working correctly


Demusion
 Share

Recommended Posts

Hello! I am quite new to the programming scheme, and I'm looking for some help regarding my newbie code.
I want it to work in a specific set of ways, but I'm not sure how to do it, so I came here for help.

So if it's possible, I want the specific to happen in the loop:

While 1
;Get to login 
MouseClick ("left", x, y, 2)

;Press the login button
MouseClick ("left", x, y)

;Wait for the login to finish
Sleep (5000)

; If the color of the button "Ok" is red, Press refresh and try again
If PixelGetColor (x ,y ) =   0xFF0000 Then MouseClick ("left", x, y)
ContinueLoop

;If it is green, then exit the loop and continue with the code
If PixelGetColor (x ,y ) =  0x008000 Then ExitLoop

Wend


If you have any questions, please feel free to ask me! :)

Link to comment
Share on other sites

Just now, Demusion said:

Hello! I am quite new to the programming scheme, and I'm looking for some help regarding my newbie code.
I want it to work in a specific set of ways, but I'm not sure how to do it, so I came here for help.

So if it's possible, I want the specific to happen in the loop:

While 1
;Get to login 
MouseClick ("left", x, y, 2)

;Press the login button
MouseClick ("left", x, y)

;Wait for the login to finish
Sleep (5000)

; If the color of the button "Ok" is red, Press refresh and try again
If PixelGetColor (x ,y ) =   0xFF0000 Then MouseClick ("left", x, y)
ContinueLoop

;If it is green, then exit the loop and continue with the code
If PixelGetColor (x ,y ) =  0x008000 Then ExitLoop

Wend


If you have any questions, please feel free to ask me! :)

I should probably explain it a little better specifically what it is that I want it to do:

If the color of the button is red, I want the loop to hit refresh and try again continuing from the top of the loop.
If it's green I want it to exit the loop and continue with the code.

Link to comment
Share on other sites

  • Moderators

@Demusion welcome to the forum. If this a desktop app/web app/ etc? There are much easier ways to click the button, based on its current state, than using pixelgetcolor. Look at the AutoIt Window Info Tool in the same directory where you installed AutoIt, and hover over the button to see what information it gives you. It is always better to interact with a control (if possible) than to try mouse clicks.

"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

16 hours ago, JLogan3o13 said:

@Demusion welcome to the forum. If this a desktop app/web app/ etc? There are much easier ways to click the button, based on its current state, than using pixelgetcolor. Look at the AutoIt Window Info Tool in the same directory where you installed AutoIt, and hover over the button to see what information it gives you. It is always better to interact with a control (if possible) than to try mouse clicks.

Many thanks for the welcome :)
This is a flash based application in google chrome. Thank you, I'll try that.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...