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 

control get text

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Invalid User



Joined: 14 Feb 2005
Posts: 442
Location: Texas, Usa

PostPosted: Mon Apr 18, 2005 8:11 am    Post subject: control get text Reply with quote

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 Smile
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
TheLostBoy



Joined: 18 Apr 2005
Posts: 14
Location: WI, USA

PostPosted: Mon Apr 18, 2005 10:19 am    Post subject: Reply with quote

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. Evil or Very Mad

Perhaps there is someone else out there who can help you mate... I did what I could. Rolling Eyes
_________________
"It was when I found out I could make mistakes that I knew I was on to something."
--Ornette Coleman
Back to top
View user's profile Send private message Visit poster's website AIM Address
Serenity



Joined: 07 Nov 2004
Posts: 1276

PostPosted: Mon Apr 18, 2005 12:42 pm    Post subject: Reply with quote

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


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Mon Apr 18, 2005 1:43 pm    Post subject: Re: control get text Reply with quote

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
View user's profile Send private message Send e-mail
Invalid User



Joined: 14 Feb 2005
Posts: 442
Location: Texas, Usa

PostPosted: Mon Apr 18, 2005 7:30 pm    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
TheLostBoy



Joined: 18 Apr 2005
Posts: 14
Location: WI, USA

PostPosted: Tue Apr 19, 2005 12:23 pm    Post subject: Reply with quote

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 Rolling Eyes lol!
_________________
"It was when I found out I could make mistakes that I knew I was on to something."
--Ornette Coleman
Back to top
View user's profile Send private message Visit poster's website AIM Address
Invalid User



Joined: 14 Feb 2005
Posts: 442
Location: Texas, Usa

PostPosted: Tue Apr 19, 2005 6:54 pm    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Display posts from previous:   
Post new topic   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