Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Cursor info box text


  • Please log in to reply
14 replies to this topic
df
  • Members
  • 13 posts
  • Last active: Mar 04 2006 06:55 PM
  • Joined: 30 Jul 2005
How can I get the text of an info box that follows the cursor, the program I am using is memory-map(ordnance survey) and a box follows the cursor showing it's coordinates,I would like to get the text shown in this box to capture the coordinates for map calibration.
Any ideas?

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
SetTimer
MouseGetPos
ToolTip
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.

garath
  • Members
  • 398 posts
  • Last active: Feb 05 2011 10:31 PM
  • Joined: 24 Mar 2005
I believe, he wants the text from the tooltip window in his application, this is a good question, don`t know a solution. I can`t catch those windows with windows-spy, because they always move beside the Mouse-cursor.
#I am interested in a solution, too. :?

df
  • Members
  • 13 posts
  • Last active: Mar 04 2006 06:55 PM
  • Joined: 30 Jul 2005
Yes it's actually the text I'm after, it gets confusing as the text is 'coordinates' from a OS map rather than mouse coordinates, once captured both sets of coordinates(mouse and grid ref) will be used to calibrate a map image(screenshot) for use on a palm with gps.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
I think you could find out the class name of such tooltips and other unusual-behavior windows using Winspector Spy or a script that uses "WinGet List" and WinGetClass to report the classes of all windows on the script.

garath
  • Members
  • 398 posts
  • Last active: Feb 05 2011 10:31 PM
  • Joined: 24 Mar 2005
Hmm, I played arround a bit.
I can get the class of a tooltip.
I can use the class to change the Windows Title of a Tooltip.
But I couldn`t see any controls within a Tooltip_Window, so I found no way to retreive the text of a Tooltip.
Does anybody know, how to retrieve text from a Tooltip_Window?

shimanov
  • Members
  • 610 posts
  • Last active: Jul 18 2006 08:35 PM
  • Joined: 25 Sep 2005
TTM_GETTEXT

If you intend to access a ToolTip created by a process other than your own, it will likely require remote memory access.

Decarlo110
  • Members
  • 303 posts
  • Last active: Feb 12 2006 02:15 AM
  • Joined: 15 Dec 2004

Does anybody know, how to retrieve text from a Tooltip_Window?

Read this thread: Can Autohotkey capture tooltip text?
1) The Open Source Definition http://www.opensourc...ition_plain.php

2) Intuitive. Logical. Versatile. Adaptable. <>

shimanov
  • Members
  • 610 posts
  • Last active: Jul 18 2006 08:35 PM
  • Joined: 25 Sep 2005

Read this thread: Can Autohotkey capture tooltip text?


You're right. I just tested ControlGetText against a ToolTip with a title, and it does retrieve the text. I wasn't sure what it would retrieve in that case.

CoordMode, ToolTip, Screen
ToolTip, hello`, world, 50, 50

Sleep, 100

WinGet, hw_tt, ID, ahk_class tooltips_class32

SendMessage, 0x400+32, 1, "the title",, ahk_id %hw_tt%
;MsgBox, %ErrorLevel%

SendMessage, 0x400+29,,,, ahk_id %hw_tt%

Sleep, 100 

WinGetTitle, title, ahk_id %hw_tt%
ControlGetText, text,, ahk_id %hw_tt%

MsgBox, %title%`n`n%text%


df
  • Members
  • 13 posts
  • Last active: Mar 04 2006 06:55 PM
  • Joined: 30 Jul 2005
Works a treat! Thanks guys :D

garath
  • Members
  • 398 posts
  • Last active: Feb 05 2011 10:31 PM
  • Joined: 24 Mar 2005

Does anybody know, how to retrieve text from a Tooltip_Window?

Read this thread: Can Autohotkey capture tooltip text?

grr, should have searched the Forum, thanks Declaro110!

@shimanov
Your script-example is working well. I think, my problem is, that I reached the borders of AHK, now I need to understand, how WindowsXp works. Dllcalls and SendMessages are books with seven seals for me. So I will do Rajats Send-tutorial, now, have a nice weekend :wink:

shimanov
  • Members
  • 610 posts
  • Last active: Jul 18 2006 08:35 PM
  • Joined: 25 Sep 2005

I reached the borders of AHK


Fortunately, with SendMessage and DllCall, those borders have a low threshold. And within the borders, you are mostly limited by your own creativity, as many in this community have aptly demonstrated.

So I will do Rajats Send-tutorial


That is a good resource and you should consider complementing that tutorial with Microsoft's own Windows 2000/XP/etc. SDK (Software Development Kit), which includes documentation, header files, and more. This is where you will find the API documented, as well as, the codes for SendMessage/PostMessage, DllCall, etc.

now, have a nice weekend :wink:


Thank you.

garath
  • Members
  • 398 posts
  • Last active: Feb 05 2011 10:31 PM
  • Joined: 24 Mar 2005
Made a little script to display all Tooltips in a system.
It seems, that the tool-tips generated by browsers with their OnMousover-command do not use the Windows Tooltip-Structures. :(
here the Test-script: (Press F1 to start script)
F1::
DetectHiddenWindows, On 
DetectHiddenText, On 
Total_info =
WinGet, id, list, ahk_class tooltips_class32
Loop, %id%
{
	StringTrimRight, this_id, id%a_index%, 0
	ControlGetText, OutputVar,,ahk_id %this_id%
	WinGetTitle, this_title, ahk_id %this_id%
	Total_info := Total_info . "`tFensterID    `t" . id%a_index% . "`tTitel`t" . this_title . "`tText`t" . OutputVar . "`n"
	id%a_index% =
}
id0 =
gui, destroy
Gui, Add, Text,, %Total_info%
gui, show, All_Tooltip_Dispay
Total_info =
Control, Style, 0x200000, static1, All_Tooltip_Dispay
return
@shimanov
had a look for the TTM_GETTEXT Message
my problem is this part of the message:

lResult = SendMessage( // returns LRESULT in lResult
(HWND) hWndControl, // handle to destination control
(UINT) TTM_GETTEXT, // message ID
(WPARAM) wParam, // = 0; not used, must be zero
(LPARAM) lParam // = (LPARAM) (LPTOOLINFO) lpti;
);

lpti
Pointer to a TOOLINFO structure. The cbSize member of this structure must be filled in before sending this message. Set the hwnd and uId members to identify the tool for which to retrieve information. Set the lpszText member to point to a buffer that receives the text. There currently is no way to specify the size of the buffer or to determine the required buffer size.

I am not sure, what to do with this Info, I think I will have to do something with this structure first. Somewhere in the Forum I read, that it should be nearly impossible to read a structure with AHK. But I also saw this Article by corrupt
http://www.autohotke... ... =structure
Is this the solution to the problem with reading structures?

shimanov
  • Members
  • 610 posts
  • Last active: Jul 18 2006 08:35 PM
  • Joined: 25 Sep 2005

Pointer to a TOOLINFO structure. The cbSize member of this structure must be filled in before sending this message. Set the hwnd and uId members to identify the tool for which to retrieve information. Set the lpszText member to point to a buffer that receives the text.


Review the following:

There is one missing statement, that is the value for uId. I have not tested it.

The uID member of the TOOLINFO structure is defined by the application.
...
When you add a tool implemented as a window, the uID member of the TOOLINFO structure must contain the window handle to the tool. Also, the uFlags member must specify the TTF_IDISHWND value, which tells the ToolTip control to interpret the uID member as a window handle.


ti_size = 44
VarSetCapacity( ti, ti_size )

text_size = 100
VarSetCapacity( text, text_size )

buffer := Chr( 44 )
InsertInteger( wid, ti, 8 )
; InsertInteger( id, ti, 12 )
InsertInteger( &text, ti, 36 )

SendMessage, TTM_GETTEXT, 0, &ti,, ahk_id %wid%

But I also saw this Article by corrupt
http://www.autohotke... ... =structure
Is this the solution to the problem with reading structures?


It is a start. However, it may be sufficient for the present task. You could also use Chris's "ExtractInteger" from the DllCall page.

someone
  • Guests
  • Last active:
  • Joined: --
Hello,
somebody kowns how to do it in C++ ? ( Windows)

with TTM_GETTEXT i suppose...

thanks