Jump to content

tooltip


Recommended Posts

  • Moderators

here is s silly question how do you read infomation from a tooltip?

This worked:
ToolTip('This is a tooltip test', 0, 0)
Sleep(1000)
MsgBox(0, 'Get ToolTipData','The ToolTip reads:' & @CR & _GetToolTipData())

Func _GetToolTipData($sClass = 'tooltips_class32')
    $OptWMM = Opt('WinTitleMatchMode', 4)
    Local $vTTData = WinGetTitle('classname=' & $sClass)
    Opt('WinTitleMatchMode', $OptWMM)
    Return $vTTData
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

seems to work good if the script that sets the tooltip can find it. set the tooltip with a different script and see if it finds it, it doesn't work for me in the way i stated.

I was afraid you would say that... The only way I can say for sure (which is why I left the $sClass an "optional" parameter is you would have to know the Class of the ToolTip window). This would require you to at least have the OP open and a tooltip window up while you were running the function to get the class, and match that to the text that is in that window. I'll see what I can come up with to give you an idea of what my jabbering is about.

Edit:

This may help to find the class to use as the parameter for the first function I gave:

$Textofothertooltip = 'Some Text' ; change this text to some text on the real tool tip
$i = 1
While 1
    $FindClass = _LocateClass($Textofothertooltip)
    If $FindClass Then ExitLoop
    Sleep(100)
    If $i = 20 Then ToolTip('Some Text', 0, 0)
    If $i < 19 Then ToolTip('Count is: ' & $i, 0, 0)
    $i += 1
WEnd

ClipPut($FindClass) ; put it to your clip board
MsgBox(64, 'Class', 'The Class is: ' & $FindClass & @CR & 'And now you can use that class in the parameter')

Func _LocateClass($sText)
    Local $aWinList = WinList()
    For $iCount = 1 To $aWinList[0][0]
        If StringInStr($aWinList[$iCount][0], $sText) Then
            $aClass = DllCall('User32.dll', 'int', 'GetClassName', 'hwnd', $aWinList[$iCount][1], 'str', '', 'int', 30000)
            If Not @error Then Return $aClass[2]
        EndIf
    Next
    Return 0
EndFunc
I tested with 2 different tooltips because I didn't have another program off hand that I knew used tooltips (If the others don't act the same, maybe you could use WinGetText() rather than WinGetTitle()). Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Isn't more easier to save text in variable? :D

Global $mytext = 'Hey, you!'
ToolTip($mytext,0,0)
MsgBox(64,"Text",$mytext)

i542

Well, that would be quite efficient if it wasn't "another" program wouldn't it :D

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
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
 Share

  • Recently Browsing   0 members

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