 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
lost
Joined: 08 Mar 2005 Posts: 10
|
Posted: Thu Mar 10, 2005 12:32 am Post subject: Text under the mouse pointer |
|
|
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 |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Thu Mar 10, 2005 1:22 am Post subject: |
|
|
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 |
|
 |
Andi
Joined: 11 Feb 2005 Posts: 157 Location: Germany, Niestetal
|
Posted: Tue Mar 15, 2005 9:15 pm Post subject: |
|
|
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.
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  |
|
| Back to top |
|
 |
lost
Joined: 08 Mar 2005 Posts: 10
|
Posted: Thu Mar 17, 2005 5:21 am Post subject: |
|
|
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 |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|