Jump to content
Sign in to follow this  
AC130

Question

Recommended Posts

AC130

Hello again.

I have a question, how do you stop a script?

I have my program set to search for a pixel after i press the gui button.

Case $Command1
            $Pixel = PixelSearch ( 0, 0, @DesktopWidth, @DesktopHeight, 0x000000)
            If Not @Error Then
                MouseClick ( "left" , $Pixel[0], $Pixel[1])
; Now I want it to end that script and start the script below:
                $Pixel2 = PixelSearch ( 0, 0, @DesktopWidth, @DesktopHeight, 0x111111)
MouseClick ( "left" , $Pixel1[0], $Pixel1[1]

EndIf
Edited by AC130

Share this post


Link to post
Share on other sites
dufran3

??

Case $Command1
    While 1 
        $Pixel = PixelSearch ( 0, 0, @DesktopWidth, @DesktopHeight, 0x000000)
            If Not @Error Then MouseClick ( "left" , $Pixel[0], $Pixel[1])
    WEnd
; Now I want it to end that script and start the script below:
    While 1
        $Pixel2 = PixelSearch ( 0, 0, @DesktopWidth, @DesktopHeight, 0x111111)
        MouseClick ( "left" , $Pixel1[0], $Pixel1[1]
    WEnd

Share this post


Link to post
Share on other sites
AC130

oh rofl! see i was trying to hard. :unsure: thanks dude!!

Share this post


Link to post
Share on other sites
dufran3

are you making sure you end your Case statement correctly?

Select
    Case $Command1
        While 1
            $Pixel = PixelSearch ( 0, 0, @DesktopWidth, @DesktopHeight, 0x000000)
            If Not @Error Then MouseClick ( "left" , $Pixel[0], $Pixel[1])
        WEnd
        ;Script Has Now Ended
                
        While 1
            $Pixel2 = PixelSearch ( 0, 0, @DesktopWidth, @DesktopHeight, 0x111111)
            If Not @Error Then Msgbox (0,'', 'blah blah' )
        WEnd
EndSelect
Edited by dufran3

Share this post


Link to post
Share on other sites
dufran3

Select...Case...EndSelect is a conditional statement. Check the help file. It will explain it.

Share this post


Link to post
Share on other sites
dufran3

the problem is with your $Command1 variable. If I set $Command1 = 1, the script works.

Share this post


Link to post
Share on other sites
dufran3

that isn't what you want to do.

Try adding a debug to see what is being assigned to $Command variable.

ConsoleWrite('$command1: ' & $command1)

Share this post


Link to post
Share on other sites
dufran3

where do i put this at?

put it above the while statement.

isn't there a way to like sleep until it finds that pixel?

you can put a sleep in between checks, yeh... Sleep()

Share this post


Link to post
Share on other sites
AC130

nevermine. I got it works. thanks for allll the help!! :unsure:

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.