Jump to content
Sign in to follow this  

_MouseTrap Help

Recommended Posts


This is using PixelGetColor so that if my cursor goes over a specific pixel, it left clicks. I'm using this script inside of an application, I need to MouseTrap these coords @DesktopWidth /2, @DesktopHeight /2 but also mousetrap inside of an application (Not a standard GUI). Incase you misunderstand my intent, I want the mouse to be trapped ONTOP of this application, it is trapping it BEHIND the application right now. Im wondering if I can put something similar to WinGetPos or $Local

Func _Start()
$Var = 1
While 1 = 1
_MouseTrap(@DesktopWidth /2, @DesktopHeight /2)
$Position = MouseGetPos()
$coord = PixelGetColor ($Position[0], $Position[1])
If $coord = $Color Then
MouseClick ("Left")

Share this post

Link to post
Share on other sites

I want to use the _MouseTrap function to center the mouse in the middle of my screen and then use sleep to let it move for 1 second. Possible?

Note that this is part of an existing script, so sleep cannot interfere with the rest of it.

Not the question I am asking here, I was asking how to mouse trap in the center of my screen, I solved this myself by using DesktopHeight and Width divided by 2. Different questions.

I want to make it so my cursor is on top of any and all windows, including applications which might take control of it. For example, if I'm playing a flash game and I click the flash game, my cursor becomes the crosshair. I dont want any other functionality other than the mouse being on top of the window, I can work the rest of the kinks out myself. I can't seem to find anything in the help files related to this.

I still want control over the window tho, I can imagine that if successful the cursor will just be on top of the cross hair, even in movement. Thanks in advance

In this thread I asked how to keep the mouse ontop of a window, in my current thread i am asking how to use mousetrap within a window but also within a specific coord in that window. Seperate questions.

So the questions are

1. How can I get my cursor to be ontop of a fullscreen window?

Has nothing to do with either of the 3 questions except for mouse on top, but this is in specification to full screen.

I dont understand why you went through the effort to look up my threads, post them back here, but did not help me solve any of my issues.

So my ultimate question is, How can I use _MouseTrap in a window like this

$Window = WinGetPos()
_MouseTrap ($Window[0], $Window[1])

but also trapping it within certain coords INSIDE that window, like this

_MouseTrap (@DesktopWidth /2, @DesktopHeight /2)

Maybe if someone answered one of my threads, I'd stop posting them?, Just a theory.

Edited by TRK

Share this post

Link to post
Share on other sites

Heres a theory of mine, the threads are absolutely and directly linked to the exact same thing.

Heres another on (and it is just a theory)

The window does not take control of your mouse, the mouse is in your control, and it just changes the cursor, so you could be trying to get a phantom extra cursor to appear.

I could of course be wrong.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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