Jump to content

Is there some way to stop loop ?


Recommended Posts

Well i am working in autoit second day so far and i ve tried everythink i know searched Google and didnt found anythink about this .I want to make the code to sleep after it has been done 2 times and untill the other color apears but when i do sleep() than the whole script does not look for color what i dont want i ve ;;showed the place where it should sleep with pixelsearch still active

#cs ----------------------------------------------------------------------------
    AutoIt Version: 3.3.0.0
    Author:      Unreal
#ce ----------------------------------------------------------------------------

HotKeySet("{F3}", "StartProg") 
HotKeySet("{F4}", "ExitProg") 


While 1
Sleep(100) 
Wend

Func StartProg()
WinActivate("GBP/USD, 5-Minute, Bid")
FirstCheck()
    
EndFunc

Func FirstCheck()
    PixelSearch(1471 ,22 ,1479 ,514 ,0xFFFF00)
    If @error = 0 Then
        WinActivate("Bez názvu – Poznámkový blok")
        Send(" Najdena Zlta ")
        WinActivate("GBP/USD, 5-Minute, Bid")
        Sleep(6000)
        $myColor = PixelSearch(1471 ,22 ,1479 ,514 ,0xFFFF00)
        If @error = 0 Then
            MouseClick("left",102,55,1,0) ;; After this has been 2 times it shouldnt execute anymore till the second color appears
            WinActivate("Bez názvu – Poznámkový blok") ;; After this has been 2 times it shouldnt execute anymore till the second color appears
            Send(" Potvrdene ");; After this has been 2 times it shouldnt execute anymore till the second color appears
        EndIf
        
        while($myColor = 0xFFFF00)
            $myColor = PixelSearch(1471 ,22 ,1479 ,514 ,0xFFFF00)    
        WEnd
    Else
        SecondCheck()
EndFunc

Func SecondCheck()
    PixelSearch(1471 ,22 ,1479 ,514 ,0x8000FF)
    If @error = 0 Then
        WinActivate("Bez názvu – Poznámkový blok")
        Send(" Najdena Fialova ")
        WinActivate("GBP/USD, 5-Minute, Bid")
        Sleep(6000)
        $myColor2 = PixelSearch(1471 ,22 ,1479 ,514 ,0x8000FF)
        If @error = 0 Then
            MouseClick("left",23,59,1,0)
            WinActivate("Bez názvu – Poznámkový blok")
            Send(" Potvrdene ")
        EndIf
EndIf           
EndFunc


Func ExitProg()
Exit 0 
EndFunc

Is there some way to do "balance" ? so when i reach some time of count some part of function disables untill i dont want it to stop being disabled ? :)

Thank you

Edited by ForsakenGod
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...