Jump to content
Sign in to follow this  
Argentino

Help making this script work

Recommended Posts

Argentino

I think is the first time i post here ^^, always been searching and learning on my own in this forum but theres something i need to learn to get to the new lvl of autoit, i have this working script:

While (1)
    Sleep (3000)
    $coord = PixelSearch(1106, 273, 1295, 331, 0x2dcbb7, 30)
    If Not @error Then
        Sleep(1000)
        MouseMove($coord[0], $coord[1])
        Sleep (2000)
        MouseClick("Left")
        Sleep(20000)
        send("{F11}")
        Sleep(6000)
        MouseClick("left", 722, 433, 2)
        Sleep(2000)
        MouseMove(1235, 286)
        
    EndIf
    If @error Then
        $coord = PixelSearch(1111, 87, 1408, 234, 0x2dcbb7, 30)
        Sleep (9000)
        MouseMove($coord[0], $coord[1])
        Sleep (3000)
        MouseClick("Left")
        Sleep(50000)
        $coord = PixelSearch(1111, 87, 1408, 234, 0x2dcbb7, 30)
        Sleep (9000)
        MouseMove($coord[0], $coord[1])
        Sleep (3000)
        MouseClick("Left")
        Sleep(50000)
        EndIf
    
WEnd

What i want to do is that after Sleep(20000) (before pressing F11) is will execute yet another pixel search to find pure white (0xffffff) in a small middle of the screen box, if it find it it will F11 and proceed if it don't i want the script to jump to the beggining, BUT if it runs out of 0x2dcbb7 searching down i need it to search up (as in actual if @error), i know more advanced scripts have functions to make all this more simple, but im just beggining, thanks for any help you can bring here.

Share this post


Link to post
Share on other sites
TerarinK

While (1)
    Sleep(3000)

    $aCoord = PixelSearch(1106, 273, 1295, 331, 0x2dcbb7, 30)
    If Not @error Then
        Sleep(1000)
        MouseMove($aCoord[0], $aCoord[1])
        Sleep(2000)
        MouseClick("Left")
        Sleep(20000)
        $aCoordW = PixelSearch([left],[top],[right],[bottom], 0xFFFFFF)
        If IsArray($aCoordW) Then
            Send("{F11}")
            Sleep(6000)
            MouseClick("left", 722, 433, 2)
            Sleep(2000)
            MouseMove(1235, 286)
        EndIf
    Else
        $aCoord = PixelSearch(1111, 87, 1408, 234, 0x2dcbb7, 30)
        Sleep(9000)
        MouseMove($aCoord[0], $aCoord[1])
        Sleep(3000)
        MouseClick("Left")
        Sleep(50000)
        $aCoord = PixelSearch(1111, 87, 1408, 234, 0x2dcbb7, 30)
        Sleep(9000)
        MouseMove($aCoord[0], $aCoord[1])
        Sleep(3000)
        MouseClick("Left")
        Sleep(50000)
    EndIf
WEnd


0x576520616C6C206469652C206C697665206C69666520617320696620796F75207765726520696E20746865206C617374207365636F6E642E

Share this post


Link to post
Share on other sites
Argentino

Thanks TerarinK, i didnt know this command "If IsArray($aCoordW) Then", so this is how you put if inside another if? awesome.

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  

×