AutoHotkey Community

It is currently May 26th, 2012, 7:03 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: MouseGetPos issue
PostPosted: May 24th, 2009, 2:28 am 
Offline

Joined: May 24th, 2009, 2:03 am
Posts: 5
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 24th, 2009, 3:31 am 
Offline

Joined: May 24th, 2009, 1:19 am
Posts: 5
try to use "On Screen" values, and not "In Active Window" values.

Did that helped?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 24th, 2009, 4:59 am 
Offline

Joined: May 24th, 2009, 2:03 am
Posts: 5
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 25th, 2009, 2:32 am 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
CoordMode, Mouse, Relative at the top of the script.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 25th, 2009, 3:44 am 
Offline

Joined: May 24th, 2009, 2:03 am
Posts: 5
Quote:
CoordMode, Mouse, Relative at the top of the script.


No effect. No change in behavior.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 27th, 2009, 3:28 pm 
Offline

Joined: May 24th, 2009, 2:03 am
Posts: 5
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,


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 27th, 2009, 3:31 pm 
Offline

Joined: May 24th, 2007, 3:45 am
Posts: 1121
Might as well post your whole script.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 27th, 2009, 8:25 pm 
Offline

Joined: April 8th, 2009, 8:23 pm
Posts: 3036
Location: Rio de Janeiro - RJ - Brasil
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.
"
Image
Antonio França
My stuff: Google Profile


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 27th, 2009, 8:37 pm 
Offline

Joined: May 3rd, 2009, 7:16 pm
Posts: 345
Location: OH, USA
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 1st, 2009, 2:31 am 
Offline

Joined: May 24th, 2009, 2:03 am
Posts: 5
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 1st, 2009, 5:37 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8666
Location: Salem, MA
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.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: dra, Exabot [Bot], rbrtryn, Yahoo [Bot] and 59 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group