Jump to content
Sign in to follow this  
Hypertrophy

[SOLVED]how to get text of tooltip in window

Recommended Posts

Hypertrophy

is there a command for this?

Edited by Hypertrophy

Share this post


Link to post
Share on other sites
dantay9

I do not think so, but you should say whether it is a gui tooltip or a windows tooltip in case I am wrong. That will help the next person in line.

Edited by dantay9

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites
Hypertrophy

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

Share this post


Link to post
Share on other sites
bogQ

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.

 

Share this post


Link to post
Share on other sites
Hypertrophy

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

Edited by Hypertrophy

Share this post


Link to post
Share on other sites
bogQ

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.

 

Share this post


Link to post
Share on other sites
Hypertrophy

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

Share this post


Link to post
Share on other sites
bogQ

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.

 

Share this post


Link to post
Share on other sites
Hypertrophy

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.

Share this post


Link to post
Share on other sites
bogQ

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.

 

Share this post


Link to post
Share on other sites
Hypertrophy

thank you bogQ. this has really helped me understand the concept of using this method. :)

Share this post


Link to post
Share on other sites
Hypertrophy

there any way to call this function besides using a hotkey? like a button or context menu?

Fixed: Instead of using tooltips I just used the GUI's title.

Edited by Hypertrophy

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×