Sign in to follow this  
Followers 0
Yuraj

How to get tooltip click?

9 posts in this topic

Hi there,

Is there a way to catch click event on tooltip - balloon tip?

I haven't found any windows message.

I'm using this code:

TrayTip("Title", "Text", 8, 1)

ShellExecute("http://www.yuraj.ucoz.com")ProcessClose(@AutoItPID)

Share this post


Link to post
Share on other sites



Hi there,

Is there a way to catch click event on tooltip - balloon tip?

I haven't found any windows message.

I'm using this code:

TrayTip("Title", "Text", 8, 1)
Look at the example script in the help file for TraySetOnEvent().

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#include <Constants.au3>
#include <GuiToolTip.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Dim $iInterval = 8, $iInit
Dim $iMSInterval = $iInterval * 1000
Dim $aWindows, $hShell_TrayWnd

TrayTip('Title', 'Text', $iInterval)

$aWindows = WinList('[CLASS:tooltips_class32]')
$hShell_TrayWnd = WinGetHandle('[CLASS:Shell_TrayWnd]')

For $i = 1 To $aWindows[0][0]
    If _WinAPI_GetParent($aWindows[$i][1]) = $hShell_TrayWnd And _
        BitAND(_WinAPI_GetWindowLong($aWindows[$i][1], $GWL_STYLE), $WS_VISIBLE) Then
        
        ExitLoop
    EndIf
Next

$iInit = TimerInit()


While TimerDiff($iInit) <= $iMSInterval
    If Not _GUIToolTip_ToolExists($aWindows[$i][1]) Then
        MsgBox(64, 'Notification', 'ToolTip was clicked')
        ExitLoop
    EndIf
    Sleep(50)
WEnd

Share this post


Link to post
Share on other sites

#include <Constants.au3>
#include <GuiToolTip.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Dim $iInterval = 8, $iInit
Dim $iMSInterval = $iInterval * 1000
Dim $aWindows, $hShell_TrayWnd

TrayTip('Title', 'Text', $iInterval)

$aWindows = WinList('[CLASS:tooltips_class32]')
$hShell_TrayWnd = WinGetHandle('[CLASS:Shell_TrayWnd]')

For $i = 1 To $aWindows[0][0]
    If _WinAPI_GetParent($aWindows[$i][1]) = $hShell_TrayWnd And _
        BitAND(_WinAPI_GetWindowLong($aWindows[$i][1], $GWL_STYLE), $WS_VISIBLE) Then
        
        ExitLoop
    EndIf
Next

$iInit = TimerInit()


While TimerDiff($iInit) <= $iMSInterval
    If Not _GUIToolTip_ToolExists($aWindows[$i][1]) Then
        MsgBox(64, 'Notification', 'ToolTip was clicked')
        ExitLoop
    EndIf
    Sleep(50)
WEnd
Yes, it's that what i'm looking for. But it's best way?

ShellExecute("http://www.yuraj.ucoz.com")ProcessClose(@AutoItPID)

Share this post


Link to post
Share on other sites

Nope, it can't be. The best is to create your own tray window so you'll get notification when the user is clicking it and not preforming this ridiculous code. ;]

Share this post


Link to post
Share on other sites

Yes, it's that what i'm looking for. But it's best way?

Authenticity's answer was better than mine. I was thinking of events from clicking on TrayMenu stuff, not the balloon tips.

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Is it possible to get autoit to click on these balloon tips?

also, I have found some code to get the text of the tip using WinGetTitle but is it possible to get the title of the tip? I'm trying to write a balloon tip logger that lets me click on those with a keystroke. Any hints would be really appreciated since I have never sued mouse movement commands before.

Share this post


Link to post
Share on other sites

A balloon tip is a window of a certain class with handle. Something like this should work:

TrayTip("Title", "Text", 10)
Sleep(1000)
$hBalloon = WinGetHandle('[CLASS:tooltips_class32; INSTANCE:1]')
If @error Then
    ConsoleWrite("Error:  No balloon" & @LF)
Else
    Sleep(1000)
    ControlClick($hBalloon, "", "")
    ConsoleWrite("Clicked on balloon:  " & $hBalloon & @LF)
    Sleep(8000)
EndIf

Note that the regular use of title and text don't work to ID the balloon window, hence the CLASS used.

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Yes, it is really strange. Yesterday I was trying something like this.

func clickit()

msgbox(0,"list",$list)

$pos=WinGetPos($list)

if @error then

speak("An error was encountered trying to get the position of the window.",3)

return 0

EndIf

MouseClick("left",$list[0],$list[1])

if @error then

speak("An error was encountered when clicking.",3)

return 0

EndIf

speak("The balloon was clicked.",3)

return 1

endfunc

WinGetTitle seems to return the text, so I couldn't click on it.

Is there any way I can get the actual title of the tip? Of course yesterday it wasn't clicking because it was trying to click on the text.

Any ideas? I'm going to use this handle now, hopefully it's gonna work.

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  
Followers 0