Jump to content

Simple Question


Recommended Posts

I would try the following code...

$var = 1

While 1
    $pos = MouseGetPos()
    $coord = PixelSearch($pos[0], $pos[1], $pos[0], $pos[1], 0x2CFD39)
    If Not @error Then
        If $var = 1 Then
            Send("{a}")
            Sleep(20)
            
            If $var = 1 Then
                MouseClick('left')
                Sleep(50)
                $var = 0
            EndIf        
        EndIf
    Else
        ExitLoop
    EndIf
WEnd

Edit: You may not want the else statement there, but I figure at some point you'll want out of the loop so I put it in there.

I hope it helps,

Jarvis

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

I would try the following code...

$var = 1

While 1
    $pos = MouseGetPos()
    $coord = PixelSearch($pos[0], $pos[1], $pos[0], $pos[1], 0x2CFD39)
    If Not @error Then
        If $var = 1 Then
            Send("{a}")
            Sleep(20)
            
            If $var = 1 Then
                MouseClick('left')
                Sleep(50)
                $var = 0
            EndIf        
        EndIf
    Else
        ExitLoop
    EndIf
WEnd

Edit: You may not want the else statement there, but I figure at some point you'll want out of the loop so I put it in there.

I hope it helps,

Jarvis

Still what is the point of $var = 1 then being there twice? nothing between the first statement and second can change the variable. and it still wont do anything after the first through.

Giggity

Link to comment
Share on other sites

The reason why it doesn't do both is you're not allowing for the speed of your system. You would need a larger sleep between them. It's just large enough when you add another evaluation in there before performing the remaining options.

If you want it to sleep at the end add that right before the WEnd.

I hope it helps,

Jarvis

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

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