 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Invalid User
Joined: 14 Feb 2005 Posts: 442 Location: Texas, Usa
|
Posted: Mon Apr 18, 2005 8:11 am Post subject: control get text |
|
|
| Code: | DetectHiddenText, On
#Persistent
SetTimer, WatchCursor, 50
return
WatchCursor:
MouseGetPos, X, Y, WindowId, ControlId,
ControlGetText, Text, %ControlId%
X += 10
Y += 10
ToolTip, Window Title: %WindowId% `n Text under mouse: ^%Text%^%ControlId%, %X%, %Y%
return
f9::Reload |
is there any reason the above script does not get the text of the control the mouse is over. Is this a bug, am I dumb. whats up? _________________ my lame sig  |
|
| Back to top |
|
 |
TheLostBoy
Joined: 18 Apr 2005 Posts: 14 Location: WI, USA
|
Posted: Mon Apr 18, 2005 10:19 am Post subject: |
|
|
Well here is what I have for a nice BRAND NEW SHINEY set of code.... (Mine is a little more fancy...even tho its not practical... just something I've been tinkering with.)
| Code: | #Persistent
DetectHiddenText, On
SetTimer, WatchCursor, 50
return
WatchCursor:
MouseGetPos, X, Y, WIN, CONTROL
WinGetTitle, title, ahk_id %win%
ControlGetText, text, ahk_id %control%
PixelGetColor, color, X, Y, RGB
ToolTip, Title = "%title%"`nText = "%control%"`nX = "%X%"`nY = "%Y%"`nColor = "%color%"
return |
As far as I'm looking at it, it would appear that when I assigned "WIN" to the output variable of MouseGetPos it picked it up... then used it in %win% in WinGetTitle. That works Beautiful....
I too however cannot get text of a control to appear... just the name of the control itself... which is rather annoying to have an illegitamate "Edit2" for text even though its the address bar of Internet Explorer and I should be seeing "http://www.autohotkey.com/forum/posting.php." I also tried the hidden text and got skunked on that as well.
Perhaps there is someone else out there who can help you mate... I did what I could.  _________________ "It was when I found out I could make mistakes that I knew I was on to something."
--Ornette Coleman |
|
| Back to top |
|
 |
Serenity
Joined: 07 Nov 2004 Posts: 1276
|
Posted: Mon Apr 18, 2005 12:42 pm Post subject: |
|
|
Heres one I made earlier:
| Code: | #persistent
#singleinstance force
setwindelay, -1
setbatchlines, -1
~capslock::
if A_PriorHotkey <> ~capslock
{
KeyWait, capslock, D
return
}
if A_TimeSincePriorHotkey > 400
{
KeyWait, capslock, D
return
}
If Get <> on
{
SetTimer, Get, 50
}
else
{
SetTimer, Get, off
Get = Off
ToolTip
}
return
Get:
WinGetTitle, title, A
WinGetClass, class, A
if class = tooltips_class32
tooltip
else
MouseGetPos, x, y, win, control, 1
ControlGetText, text, %control%, ahk_class %class%
tooltip, title:`t%title%`nclass:`t%class%`ncontrol:`t%control%`n%text%
Get = on
return |
_________________ "Anything worth doing is worth doing slowly." - Mae West
 |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Mon Apr 18, 2005 1:43 pm Post subject: Re: control get text |
|
|
| Invalid User wrote: | | is there any reason the above script does not get the text of the control the mouse is over. | ControlGetText requires a WinTitle (or WinClass, etc.) whenever you don't want it to use the last found window. So I think all you need to fix it is:
ControlGetText, Text, %ControlId%, ahk_id %WindowId% |
|
| Back to top |
|
 |
Invalid User
Joined: 14 Feb 2005 Posts: 442 Location: Texas, Usa
|
Posted: Mon Apr 18, 2005 7:30 pm Post subject: |
|
|
I wonder who the lostboy is. I wonder...
Thanks chris, this works fine now. And feel free to move this thread under support | Code: | DetectHiddenText, On
#Persistent
SetTimer, WatchCursor, 50
return
WatchCursor:
MouseGetPos, X, Y, WindowId, ControlId,
ControlGetText, Text, %ControlId%, ahk_id %WindowId%
X += 10
Y += 10
ToolTip, Window Title: %WindowId% `n Text under mouse: ^%Text%^%ControlId%, %X%, %Y%
return |
_________________ my lame sig  |
|
| Back to top |
|
 |
TheLostBoy
Joined: 18 Apr 2005 Posts: 14 Location: WI, USA
|
Posted: Tue Apr 19, 2005 12:23 pm Post subject: |
|
|
| Invalid User wrote: | I wonder who the lostboy is. I wonder...
|
Lol... what can I say dude... you got me addicted... from friday 4.15 til' 4.18 I got quite literally ONE hour of sleep because I've been dinkin' around on this trying to catch up to you on it... AHK is dah bissidy bissidy bomb...
Oh yea... Mike Jones move over... i'ma gansta lol! _________________ "It was when I found out I could make mistakes that I knew I was on to something."
--Ornette Coleman |
|
| Back to top |
|
 |
Invalid User
Joined: 14 Feb 2005 Posts: 442 Location: Texas, Usa
|
Posted: Tue Apr 19, 2005 6:54 pm Post subject: |
|
|
hmm well i dont think its a race I think I win with this one I have been using ahk for sometime now, however you have been progging long before me _________________ my lame sig  |
|
| 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
|