Jump to content
Sign in to follow this  
hck7h60vrmn72

goto alternative

Recommended Posts

hck7h60vrmn72

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

Share this post


Link to post
Share on other sites
403forbidden

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

Share this post


Link to post
Share on other sites
hck7h60vrmn72

thanks a lot :mellow:

I will workaround the issue of relaunching script by installing an old version of autoit, where the "goto" is available. By now I can't imagine a better way.

Share this post


Link to post
Share on other sites
GEOSoft

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!"

Share this post


Link to post
Share on other sites
hck7h60vrmn72

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.

i'll try this. thanks :mellow:

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  

×