 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
marlap
Joined: 01 Mar 2008 Posts: 11 Location: Canada
|
Posted: Fri Apr 18, 2008 12:44 pm Post subject: double-click an unknown cursor |
|
|
I'm in need of help please.
Ive been trying for weeks now to get a script like below to work.
Basically, I want a subroutine that will detect the type of cursor at x and y coordinates that are defined in calling part of the script. If the cursor at that coordinate is of type "Unknown", then I want it to double-click on that coordinate and return back to the main script. If an Unknown cursor is not detected, I simply want to return. (I have no idea why this won't do it.)
Label1:
MouseMove, x, y
If A_Cursor = Unknown
{
MouseClick, left, x, y
MouseClick, left, x, y
return
}
else
return
Seems like it should work to me, but I'm kind of new at this stuff, so any help would be appreciated. |
|
| Back to top |
|
 |
Razlin
Joined: 05 Nov 2007 Posts: 370 Location: canada
|
Posted: Fri Apr 18, 2008 1:45 pm Post subject: |
|
|
For starters you need values in your x y coordinates.
| Code: |
;MouseMove, x, y << your not moving anywhere here need values like
MouseMove, 100, 100
If A_Cursor = Unknown
{
;>>HELP>> MouseClick [, WhichButton , X, Y, ClickCount, Speed, D|U, R]
MouseClick , LEFT, 100, 100, 2 ;Will double left click at x100, y100
}
return
|
_________________ -=Raz=- |
|
| Back to top |
|
 |
marlap
Joined: 01 Mar 2008 Posts: 11 Location: Canada
|
Posted: Sat Apr 19, 2008 6:02 am Post subject: |
|
|
| Thanks for the reply Razlin. but I mentioned in my post that the x and y coordinates are already predefined in the main part of my script that calls the subroutine that I posted. For some reason still can't get it to double click at the Unknown cursor though. I'll try another post later on and try to give a better example, it's hard though without being able to post an image of what I want. Thanks for the tip on the click count though, I've modified my script accordingly. |
|
| Back to top |
|
 |
marlap
Joined: 01 Mar 2008 Posts: 11 Location: Canada
|
Posted: Sat Apr 19, 2008 6:46 am Post subject: |
|
|
Gadzooks, I found the solution, but I'm not 100% sure why it works.
It works by using the Sleep Command between the MouseMove and the If statement! Thanks for the inspiration Razlin!
Anybody care to comment why the Sleep command finally got the subroutine to work? I figure that it takes a while for Windows to assign cursors once you move the mouse to locations in applications that warrant special cursors.
MouseMove, 100, 100
Sleep 10
If A_Cursor = Unknown
{
MouseClick , LEFT, 100, 100, 2
}
return |
|
| Back to top |
|
 |
Elesar
Joined: 28 Jun 2007 Posts: 94
|
Posted: Sat Apr 19, 2008 7:03 am Post subject: |
|
|
You are correct, windows (or your system) just needs a moment to recognize that they cursor has moved to that position before it will do anything.
The MouseMove command, as far as my experience goes, actually Moves the mouse, instead of, say, warping it to that location, so there is a slight amount of travel time required before it will correctly do your if statement. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|