AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MouseGetPos issue

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
LSpooner



Joined: 24 May 2009
Posts: 5

PostPosted: Sun May 24, 2009 1:28 am    Post subject: MouseGetPos issue Reply with quote

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
View user's profile Send private message
Lazy_666



Joined: 24 May 2009
Posts: 5

PostPosted: Sun May 24, 2009 2:31 am    Post subject: Reply with quote

try to use "On Screen" values, and not "In Active Window" values.

Did that helped?
Back to top
View user's profile Send private message
LSpooner



Joined: 24 May 2009
Posts: 5

PostPosted: Sun May 24, 2009 3:59 am    Post subject: Reply with quote

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
View user's profile Send private message
Drugwash



Joined: 07 Sep 2008
Posts: 921
Location: Ploiesti, RO

PostPosted: Mon May 25, 2009 1:32 am    Post subject: Reply with quote

CoordMode, Mouse, Relative at the top of the script.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
LSpooner



Joined: 24 May 2009
Posts: 5

PostPosted: Mon May 25, 2009 2:44 am    Post subject: Reply with quote

Quote:

CoordMode, Mouse, Relative at the top of the script.


No effect. No change in behavior.
Back to top
View user's profile Send private message
LSpooner



Joined: 24 May 2009
Posts: 5

PostPosted: Wed May 27, 2009 2:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
ManaUser



Joined: 24 May 2007
Posts: 1121

PostPosted: Wed May 27, 2009 2:31 pm    Post subject: Reply with quote

Might as well post your whole script.
Back to top
View user's profile Send private message
MasterFocus



Joined: 08 Apr 2009
Posts: 3035
Location: Rio de Janeiro - RJ - Brasil

PostPosted: Wed May 27, 2009 7:25 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Solar



Joined: 03 May 2009
Posts: 345
Location: OH, USA

PostPosted: Wed May 27, 2009 7:37 pm    Post subject: Reply with quote

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
View user's profile Send private message
LSpooner



Joined: 24 May 2009
Posts: 5

PostPosted: Mon Jun 01, 2009 1:31 am    Post subject: Reply with quote

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
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Mon Jun 01, 2009 4:37 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group