Jump to content

[SOLVED]how to get text of tooltip in window


Recommended Posts

Don't know what the difference is dantay but I used GUICtrlSetTip to create the tip.

try with _GUIToolTip_GetText()

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

what is the point of $htool and $iId? and i dont think it will work with GUICtrlSetTip().

you only need to hit search button on right uper corrner of forum to finde almost anything you need

from topic Question about tooltips, How to get text from tooltips

I think the $ID is the id you used when you created the toolbar component as in

_GUICtrlToolbar_AddButton ($hToolbar, $ID, $STD_FILENEW)

So if the first id you used was 1000 then the id's are 1000, 1001,1002,.. 1007

I haven't tried it the way you showed so I could be wrong.

You can read the text of a displayed tooltip, so for your testing you could move the mouse over the control and check that the tooltip text is correct.

#include <array.au3>
#include <windowsconstants.au3>

$lastList = ''
$gui = GUICreate("test tool tip reading")
$but1 = GUICtrlCreateButton("sample button",50,50,120,22)
GUICtrlSetTip(-1,"this is the tooltip for $But1")
$but2 = GUICtrlCreateButton("Another one",50,150,120,22)
GUICtrlSetTip(-1,"Tooltip for $but2, but try controls in any other app too.")
GUISetState()
While GUIGetMsg() <> -3
    
    $List = ''
    $wl = WinList("[class:tooltips_class32]");get all th etooltips

    For $n = 1 To $wl[0][0]
        If BitAND(WinGetState($wl[$n][1]), 2) Then;if visible
            $List &= WinGetTitle($wl[$n][1]) & '; '; read the title, which for a tooltip is the text
        EndIf
    Next
        If $List <> $lastList And $List <> '' Then
            ConsoleWrite($List & "Previous = " & $lastlist & @CRLF)
            $lastList = $List
        EndIf

WEnd
Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

thanks. trying to make this into a function. no luck :)

#include <array.au3>
#include <windowsconstants.au3>
#include <GUIConstantsEx.au3>

$lastList = ''
$gui = GUICreate("test tool tip reading")
$but1 = GUICtrlCreateButton("sample button",50,50,120,22)
GUICtrlSetTip(-1,"this is the tooltip for $But1")
$but2 = GUICtrlCreateButton("Another one",50,150,120,22)
GUICtrlSetTip(-1,"Tooltip for $but2, but try controls in any other app too.")
$button3 = GUICtrlCreateButton("Show me the tooltip text", 100, 20, 150)
GUISetState()
While 1
    $msg = GUIGetMsg(1)
    Switch $msg[0]
        Case $GUI_EVENT_CLOSE
            Exit 0
        Case $button3
            GetTipText()
    EndSwitch
WEnd

Func GetTipText()
     $List = ''
    $wl = WinList("[class:tooltips_class32]");get all th etooltips

    For $n = 1 To $wl[0][0]
        If BitAND(WinGetState($wl[$n][1]), 2) Then;if visible
            $List &= WinGetTitle($wl[$n][1]) & '; '; read the title, which for a tooltip is the text
        EndIf
    Next
        If $List <> $lastList And $List <> '' Then
            ConsoleWrite($List & "Previous = " & $lastlist & @CRLF)
            $lastList = $List
        EndIf
EndFunc
Link to comment
Share on other sites

thanks. trying to make this into a function. no luck :)

#include <array.au3>
#include <windowsconstants.au3>
#include <GUIConstantsEx.au3>
$lastList = ''
$data = ''
$gui = GUICreate("test tool tip reading")
$but1 = GUICtrlCreateButton("sample button",50,50,120,22)
GUICtrlSetTip(-1,"this is the tooltip for $But1")
$but2 = GUICtrlCreateButton("Another one",50,150,120,22)
GUICtrlSetTip(-1,"Tooltip for $but2, but try controls in any other app too.")
$but3 = GUICtrlCreateButton("Show me last the tooltip text",50,100,150,22)

GUISetState()
Do
    $msg = GUIGetMsg()
    $List = ''
    $wl = WinList("[class:tooltips_class32]");get all th etooltips

    For $n = 1 To $wl[0][0]
        If BitAND(WinGetState($wl[$n][1]), 2) Then;if visible
            $List &= WinGetTitle($wl[$n][1]) & '; '; read the title, which for a tooltip is the text
        EndIf
    Next
    If $List <> $lastList And $List <> '' Then
        ConsoleWrite($List & "Previous = " & $lastlist & @CRLF)
        If $List <> "" Then $data = $lastlist
        $lastList = $List
    EndIf
    If $msg = $but3 Then MsgBox(0,"Last tooltip active",$data)

Until $msg = $GUI_EVENT_CLOSE
Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

thanks but i cant use it this way in my code. i need to be able to call it in a function whenever i need.

then youl probably need hotkey() command

something like this

#include <array.au3>
#include <windowsconstants.au3>
#include <GUIConstantsEx.au3>
HotKeySet("{F11}","tooltips")
Global $lastList = '',$data  = '',$List = ''
$gui = GUICreate("test tool tip reading")
$but1 = GUICtrlCreateButton("sample button",50,50,120,22)
GUICtrlSetTip(-1,"this is the tooltip for $But1")
$but2 = GUICtrlCreateButton("Another one",50,150,120,22)
GUICtrlSetTip(-1,"Tooltip for $but2, but try controls in any other app too.")
GUISetState()
Do
    $msg = GUIGetMsg()
Until $msg = $GUI_EVENT_CLOSE

Func tooltips()
    $wl = WinList("[class:tooltips_class32]");get all th etooltips
    For $n = 1 To $wl[0][0]
        If BitAND(WinGetState($wl[$n][1]), 2) Then;if visible
            $List = WinGetTitle($wl[$n][1]); read the title, which for a tooltip is the text
        EndIf
    Next
    If $List <> $lastList And $List <> '' Then
        MsgBox(0,"Active ToolTip",$List)
    Else
        MsgBox(0,"Sry","There arnt any tooltips in this Gui at the moment")
    EndIf
EndFunc

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...