Jump to content

goto alternative


Recommended Posts

hello, I'm new to autoit and I need your help. I have a script that waits for a red button to become blue, then clicks it.

Do
    Sleep(1000)
    
Until PixelGetColor(491, 425) = 0x1871A5

but sometimes the webpage freezes and I'd like to add a func that counts time and if the button does not becomes red in like 60 seconds, it reloads the page, clicks some menus to get to the button and starts watching it again.

goto would be perfect, maybe I need to use switch and case funcs?

Edited by hck7h60vrmn72
Link to comment
Share on other sites

hello, I'm new to autoit and I need your help. I have a script that waits for a red button to become blue, then clicks it.

Do
    Sleep(1000)
    
Until PixelGetColor(491, 425) = 0x1871A5

but sometimes the webpage freezes and I'd like to add a func that counts time and if the button does not becomes red in like 60 seconds, it reloads the page, clicks some menus to get to the button and starts watching it again.

goto would be perfect, maybe I need to use switch and case funcs?

Do something like this.

Global $Seconds = 0

Do
    Sleep(1000)
    $Seconds += 1
    If $Seconds >= 60 Then
         DoWhateverToGetItGoingAgain
         $Seconds = 0
    Endif
Until PixelGetColor(491, 425) = 0x1871A5

If I'm understanding you correctly, that should work.

Edited by 403forbidden
Link to comment
Share on other sites

GoTo went with the dinosuar age. Just create what you want in a function and then call that function as often as you have to. Similar to using the old GoSub, from the same era as GoTo.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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...