Jump to content
Sign in to follow this  

How Get Tiptext of Button from another application

Recommended Posts


How Get Tiptext of Button from another application?

Please Help me!

Share this post

Link to post
Share on other sites

How Get Tiptext of Button from another application?

Please Help me!


try this on your button

maybe this will work for you

good luck

Edit: Typo

#include <WindowsConstants.au3>
#include <GuiToolTip.au3>
#include <WinAPI.au3>
#Include <Misc.au3>

;enumerates all tooltips for given application window title or handle (app can be minimized)
;coordinate position data may or may not be in Enumtools return
;WinGetPos will return position if tooltip visible.

;a window can have one tooltip control and many tooltips (test app: VideoRedo MPEG Editor),
;or many tooltip controls with one or more tooltips per control (test app: Windows Media Player).

;Note: Windows Media Player returns inconsistent tooltip count per tool.
;(4 tool controls, 4 tooltips)
;if all visible controls are hovered over before running this script
;then tooltip count is high (7 tool controls and 30+ tooltips)
;tools are probably added/removed on demand.

;VideoRedo MPEG Editor (1 tool control only) tooltip count is consistently 21 tooltips.

;Caveat: YMMV
;some button tooltips may not be readable at all,
;or your going to have to use mouse control
;to hover over the button first to activate the tooltip
;while scanning for tooltips for that window title/hwnd in a loop.

;Author: rover

_Singleton("tooltiptest1", 0)

Global $sLastTitle

$sTitle = "Windows Media Player" ; replace with title of your app
Run("C:\Program Files\Windows Media Player\wmplayer.exe /prefetch:1") ; remove
WinWaitActive($sTitle, "", 10)
$hwnd = WinGetHandle($sTitle)
If Not IsHWnd($hwnd) Then Exit ; exit if above handle invalid
$aWL = WinList("[CLASS:tooltips_class32]")

For $i1 = 1 To $aWL[0][0]
    If IsHWnd($aWL[$i1][1]) Then
        ; get parent window handle, compare to target window handle
        $hParent = _WinAPI_GetAncestor($aWL[$i1][1], $GA_ROOTOWNER)
        $sParentTitle = WinGetTitle($hParent)
        If $hParent = $hwnd Then
            $iTipCount = _GUIToolTip_GetToolCount($aWL[$i1][1]) ; get tooltip count per tool control
            If $sLastTitle <> $sParentTitle Then
                ConsoleWrite('+Window Title = ' & $sParentTitle & @crlf)
                ConsoleWrite('+Window Hwnd = ' & $hParent & @crlf & @crlf)
                $sLastTitle = $sParentTitle
            ConsoleWrite('-tooltips_class32' & @crlf)
            ConsoleWrite('+Toolcontrol hwnd  = ' & $aWL[$i1][1] & @crlf)
            ConsoleWrite('+ToolExists = ' & _GUIToolTip_ToolExists($aWL[$i1][1]) & @crlf) ; visible = True, hidden = False
            ConsoleWrite('+Tooltip GetToolCount  = ' & $iTipCount & @crlf)

            For $i2 = 0 To $iTipCount -1 ; enumerate all tooltips for a tooltip control
                $aRet = _GUIToolTip_EnumTools($aWL[$i1][1], $i2)
                ConsoleWrite("+Tooltip text " & $i2 & " = " & $aRet[8] & @CRLF)
                ;view all returned info for tooltip control
                ;For $i3 = 0 To UBound($aRet) -1
                    ;ConsoleWrite("+> EnumTools [" & $i3 & "] - " & $aRet[$i3] & @CRLF)
Edited by rover

I see fascists...

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