Sign in to follow this  
Followers 0
HcClassic

how can i move my mouse from left top till right below

12 posts in this topic

I need some help

If this is the Screen

____________________

| x.................|

|...................|

|...................|

|...................|

|..................x|

i want to start at the first x and end at the last x

but by move the mouse over all the x and y till it reaches the last x

like in a maze

hope u understand

Share this post


Link to post
Share on other sites



Yes, so what have you tried before posting this question?

well i trying this atm

MouseMove(0,0)

Mousemove(1151,0)

Mousemove(0,1)

Mousemove(1151,1)

Mousemove(0,2)

Mousemove(1151,2)

but will take long time till finished but that wont be a problem

i was just hoping there was a faster way

and while it was moving and it detects an certain color on the ( example x = 324 y = 242)

it had to click there and stop moving with the mouse

Share this post


Link to post
Share on other sites

well i trying this atm

MouseMove(0,0)

Mousemove(1151,0)

Mousemove(0,1)

Mousemove(1151,1)

Mousemove(0,2)

Mousemove(1151,2)

but will take long time till finished but that wont be a problem

i was just hoping there was a faster way

and while it was moving and it detects an certain color on the ( example x = 324 y = 242)

it had to click there and stop moving with the mouse

Think about using a For-Next loop and look at the Parameters for the MousMove() function in the Helpfile to speed it up.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Think about using a For-Next loop and look at the Parameters for the MousMove() function in the Helpfile to speed it up.

Jos

i do not really get the For-Next loop can u explain it a bit to me please?

if u can't do it in english dutch is fine for me too

Share this post


Link to post
Share on other sites

if u can't do it in english dutch is fine for me too

Don't know why but this remark did put a smile on my face. :D

By the way: The script will look "more or less" the same in Dutch and English.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Hi there. I think this is what youre looking to do but it does take a while for the process to play itself out.

If you want to make it faster, you could add something like a Step to it to skip a few actual pixel locations on the screen.

Example()

Func Example()

For $y = 0 To @DesktopHeight

    For $x = 0 To @DesktopWidth
        HotKeySet("{ESC}", "Stop")
        
        MouseMove($x, $y)
        
        
    Next
    
Next

EndFunc

Func Stop()
    
Exit

EndFunc

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Don't know why but this remark did put a smile on my face. :D

By the way: The script will look "more or less" the same in Dutch and English.

Jos

well i still dont understand it

i readed help

still no clue how it works

edit :

i try DustinBowers his way

Edited by HcClassic

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

well i still dont understand it

i readed help

-snip

still no clue how it works

No need to Cut&Paste the Helpfile page. What part is unclear to you?

Is it what a For-Next is supposed to do or how to apply it for your purpose?

Anyway, look one post above yours for some hints.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

If all youre trying to do is locate a color on the screen and click it when it appears use the pixelsearch. Ive included a quick example, I hope it helps.

I didnt realize you were looking for a color the first time i read your post. Hope this helps a little more. should work a lot quicker too.

Example2()

Func Example2()
$Color = "0xFFFFFF"


While 1
Sleep(50)
$XY = PixelSearch( 0, 0, @DesktopWidth, @DesktopHeight, $Color)
HotKeySet("{ESC}", "Stop")
    If Not @error Then
    
        MouseClick("Left", $XY[0], $XY[1], 1, 10)
        MsgBox(0, "Found", $Color & " was found at:" & $XY[0] & "," & $XY[1], @DesktopWidth/2, @DesktopHeight/2)
        Stop()
    EndIf

    
WEnd

EndFunc


Func Stop()

Exit

EndFunc

Share this post


Link to post
Share on other sites

If all youre trying to do is locate a color on the screen and click it when it appears use the pixelsearch. Ive included a quick example, I hope it helps.

I didnt realize you were looking for a color the first time i read your post. Hope this helps a little more. should work a lot quicker too.

Example2()

Func Example2()
$Color = "0xFFFFFF"


While 1
Sleep(50)
$XY = PixelSearch( 0, 0, @DesktopWidth, @DesktopHeight, $Color)
HotKeySet("{ESC}", "Stop")
    If Not @error Then
    
        MouseClick("Left", $XY[0], $XY[1], 1, 10)
        MsgBox(0, "Found", $Color & " was found at:" & $XY[0] & "," & $XY[1], @DesktopWidth/2, @DesktopHeight/2)
        Stop()
    EndIf

    
WEnd

EndFunc


Func Stop()

Exit

EndFunc

well if i move my mouse from x=0 and y=0 over till @desktopwidth , @desktopheight

then if a red pixel for example suddenly appears when my mouse were at x = 241 y = 141 ( just some random y - x )

i want it to click at my current mouseposition which would be x = 241 and y = 141 then(mouseclick "left" 241,141,1)

and when it click at the postition i want it to stop move my mouse and just do some other random action

Share this post


Link to post
Share on other sites

Ok i think i understand what you want to do so try this :

Example()

Func Example()
$Color = "0xFFFFFF"

For $y = 0 To @DesktopHeight

    For $x = 0 To @DesktopWidth
        HotKeySet("{ESC}", "Stop")
        
        MouseMove($x, $y)
        $GetColor = PixelGetColor($x, $y)
            
            If $GetColor = $Color Then
                MouseClick("Left", $x, $y, 1, 10)
                Stop()
            EndIf
        
    Next
    
Next

EndFunc

Func Stop()
    
Exit

EndFunc

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  
Followers 0