| View previous topic :: View next topic |
| Author |
Message |
LSpooner
Joined: 24 May 2009 Posts: 5
|
Posted: Sun May 24, 2009 1:28 am Post subject: MouseGetPos issue |
|
|
I am trying to automate an application with a custom list box. Window Spy cannot see the text in this list box. Here is the situation.
Custom list box
--------------------------
line 1
line 2
line 3
line 4
....
line N
-------------------------
As per Window Spy the positions (Y) of
line 1 = 250
line 2 = 262
line 3 = 274
line 4 = 286
I run the following:
Click 50, 650
MouseGetPos, X, Y
Line 4 gets clicked, because there are no other items in the list, but MouseGetPos sets Y to 650, the value that was passed to Click. This is despite the fact the mouse Y is somewhere near 286.
The same behavior occurs if I use MouseMove and MouseClick.
How can I get the actual mouse position?
Thanks |
|
| Back to top |
|
 |
Lazy_666
Joined: 24 May 2009 Posts: 5
|
Posted: Sun May 24, 2009 2:31 am Post subject: |
|
|
try to use "On Screen" values, and not "In Active Window" values.
Did that helped? |
|
| Back to top |
|
 |
LSpooner
Joined: 24 May 2009 Posts: 5
|
Posted: Sun May 24, 2009 3:59 am Post subject: |
|
|
| Quote: |
try to use "On Screen" values, and not "In Active Window" values.
Did that helped?
|
No, interestingly the X co-ordinate changed (to 820) but the Y remained the same (650). Relative to the screen Window Spy shows X=820 Y=286 since the window starts at Y 0 |
|
| Back to top |
|
 |
Drugwash
Joined: 07 Sep 2008 Posts: 921 Location: Ploiesti, RO
|
Posted: Mon May 25, 2009 1:32 am Post subject: |
|
|
| CoordMode, Mouse, Relative at the top of the script. |
|
| Back to top |
|
 |
LSpooner
Joined: 24 May 2009 Posts: 5
|
Posted: Mon May 25, 2009 2:44 am Post subject: |
|
|
| Quote: |
CoordMode, Mouse, Relative at the top of the script.
|
No effect. No change in behavior. |
|
| Back to top |
|
 |
LSpooner
Joined: 24 May 2009 Posts: 5
|
Posted: Wed May 27, 2009 2:28 pm Post subject: |
|
|
Folks, any help here?
I have tried everything I can think of. Including very marginal things like reactivating the window, still no change in behavior.
Is there any way of getting the correct mouse co-ordinates after using Click, MouseClick, SendEvent, etc?
Thanks, |
|
| Back to top |
|
 |
ManaUser
Joined: 24 May 2007 Posts: 1121
|
Posted: Wed May 27, 2009 2:31 pm Post subject: |
|
|
| Might as well post your whole script. |
|
| Back to top |
|
 |
MasterFocus
Joined: 08 Apr 2009 Posts: 3035 Location: Rio de Janeiro - RJ - Brasil
|
Posted: Wed May 27, 2009 7:25 pm Post subject: |
|
|
I'm confused... posting your script would be helpful...
Maybe a PixelSearch, I dunno... _________________ "Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried."
Antonio França
My stuff: Google Profile |
|
| Back to top |
|
 |
Solar
Joined: 03 May 2009 Posts: 345 Location: OH, USA
|
Posted: Wed May 27, 2009 7:37 pm Post subject: |
|
|
Just because windowspy can't see the text in a ListBox doesn't mean the contents can't be retrieved. In fact, it normally doesn't show ListBox contents. Try this:
| Code: | ControlGet, listvar, List,, ListBox1, WinTitle
If ErrorLevel
MsgBox Get ListBox failed.
Else
MsgBox %listvar% |
If this works, I would recommend using the SendMessage API for better performance. |
|
| Back to top |
|
 |
LSpooner
Joined: 24 May 2009 Posts: 5
|
Posted: Mon Jun 01, 2009 1:31 am Post subject: |
|
|
Thanks for all the suggestions, unfortunately none have worked. I cannot post the script as is because it is being used to partially automate a game, which is against the policy of the game provider. They have already banned many other programs, I do not want them to ban AHK.
I have found another approach which does not involve getting the mouse position, so my problem is solved.
Thanks again. |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 8255 Location: Maywood, IL
|
Posted: Mon Jun 01, 2009 4:37 am Post subject: |
|
|
you might need a sleep before you mousegetpos
Come to think of it, why do you expect the Y value to be anything /other/ than 650, since that is where you just told the mouse to go. _________________
(Common Answers) |
|
| Back to top |
|
 |
|