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 

Text under the mouse pointer

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
lost



Joined: 08 Mar 2005
Posts: 10

PostPosted: Thu Mar 10, 2005 12:32 am    Post subject: Text under the mouse pointer Reply with quote

Hi,
here is a trial for something I saw in the "wish list"

Code:

^w::
Mousegetpos,cx,cy,
pixelgetcolor,pc,%cx%,%cy%
ny=%cy%
loop
{
   ny-=1
   pixelgetcolor,npc,%cx%,%ny%
   if npc<>pc
   {
      sy=%ny%
      break
   }
}
ny=%cy%

loop   
{
   ny+=1         
   pixelgetcolor, npc,%cx%,%ny%
   if npc<>pc
   {
      fy=%ny%
      break
   }
}
clipboard=
mouseclick,,%cx%,%sy%
MouseClickDrag,L,%cx%,%sy%,%cx%,%fy%
Send, ^c
if clipboard=
{
   return
}
MsgBox, %clipboard%
return

^q::
exitapp
return


I know it's not perfect as I want it to be ...
please try it and feel free to edit and please share the result.

thanks

Lost
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Thu Mar 10, 2005 1:22 am    Post subject: Reply with quote

It seems like a good way to work around the fact that "ControlGet, Selected" tends to work only with basic edit controls.

Thanks for sharing it.
Back to top
View user's profile Send private message Send e-mail
Andi



Joined: 11 Feb 2005
Posts: 157
Location: Germany, Niestetal

PostPosted: Tue Mar 15, 2005 9:15 pm    Post subject: Reply with quote

All the time I asked myself why this works? I discovered that the script works, in this manner, because it sends a doubleclick... or am I wrong here?

Quote:
mouseclick,,%cx%,%sy%
MouseClickDrag,L,%cx%,%sy%,%cx%,%fy%


I think that the "pixelgetcolor,pc,%cx%,%cy%" has no effect. Sad

So the script below does the same:
Code:

^b::
clipboard=
MouseClick, left, , , 2
Send, ^c
if clipboard=
   return
MsgBox, %clipboard%
return


But the question is, how to detect text under the mouse, using the pixelgetcolor function Question
Back to top
View user's profile Send private message
lost



Joined: 08 Mar 2005
Posts: 10

PostPosted: Thu Mar 17, 2005 5:21 am    Post subject: Reply with quote

Hi,
Quote:

I think that the "pixelgetcolor,pc,%cx%,%cy%" has no effect.


well, The idea here was a trial to find the start and the end of the text under the mouse by detecting the color pixel by pixel ( both directions starting from the mouse pointer's initial position ).

Quote:

All the time I asked myself why this works? I discovered that the script works, in this manner, because it sends a doubleclick... or am I wrong here?

mouseclick,,%cx%,%sy%
MouseClickDrag,L,%cx%,%sy%,%cx%,%fy%


;mouseclick,,%cx%,%sy%
I'm sorry, this line has no effect , I forgot to remove it!

MouseClickDrag,L,%cx%,%sy%,%cx%,%fy%
this line is used to select text between the start and end pixels.!

I thought this could be a good way to detect the text..!
sure it's not the best. but that what I could try..!

thanks for the comment.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions 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