Jump to content

Only display tooltip if it's not already showing


Recommended Posts

Hi,

I'm currently running a function every 250 milliseconds using AdlibEnable. If something happens then a tooltip is shown. However, the problem may not always be fixed instantly, and so the tooltip will be shown again. Is there anyway to only show it IF it's not already showing?

Thanks,

Touch!

[center][font="Arial"]If practise makes perfect and no-ones perfect whats the point of practise?[/font]Sorry for my rude attitude when I started here.[/center]

Link to comment
Share on other sites

I think you're looking for this function, TrayTipWait() I can't remember who wrote it.

Func _TrayTipWait($s_TrayTitle, $s_TrayText, $i_TimeOut, $i_Option = 0)
    Local $i_PrevMatchMode = Opt("WinTitleMatchMode", 4)
    Local $i_StartTimer, $aWindows, $h_TrayTip, $b_Clicked = 0

    If $s_TrayText = "" Then
        TrayTip("", "", 30)
    Else
        $i_StartTimer = TimerInit()
        TrayTip($s_TrayTitle, $s_TrayText, 30, $i_Option)

        $aWindows = WinList("[CLASS:tooltips_class32]")
        For $iX = 1 To $aWindows[0][0]
            If BitAND(WinGetState($aWindows[$iX][1]), 2) Then
                $h_TrayTip = $aWindows[$iX][1]
                ExitLoop
            EndIf
        Next

        While BitAND(WinGetState($h_TrayTip), 2) And (TimerDiff($i_StartTimer) < (1000 * $i_TimeOut))
            Sleep(100)
        WEnd
        If TimerDiff($i_StartTimer) < (1000 * $i_TimeOut) Then
            $b_Clicked = 1
        Else
            TrayTip("", "", 10)
            $b_Clicked = 0
        EndIf
    EndIf
    Opt("WinTitleMatchMode", $i_PrevMatchMode)
    Return $b_Clicked
EndFunc  ;==>_TrayTipWait
Link to comment
Share on other sites

  • Moderators

I think you're looking for this function, TrayTipWait() I can't remember who wrote it.

Func _TrayTipWait($s_TrayTitle, $s_TrayText, $i_TimeOut, $i_Option = 0)
    Local $i_PrevMatchMode = Opt("WinTitleMatchMode", 4)
    Local $i_StartTimer, $aWindows, $h_TrayTip, $b_Clicked = 0

    If $s_TrayText = "" Then
        TrayTip("", "", 30)
    Else
        $i_StartTimer = TimerInit()
        TrayTip($s_TrayTitle, $s_TrayText, 30, $i_Option)

        $aWindows = WinList("[CLASS:tooltips_class32]")
        For $iX = 1 To $aWindows[0][0]
            If BitAND(WinGetState($aWindows[$iX][1]), 2) Then
                $h_TrayTip = $aWindows[$iX][1]
                ExitLoop
            EndIf
        Next

        While BitAND(WinGetState($h_TrayTip), 2) And (TimerDiff($i_StartTimer) < (1000 * $i_TimeOut))
            Sleep(100)
        WEnd
        If TimerDiff($i_StartTimer) < (1000 * $i_TimeOut) Then
            $b_Clicked = 1
        Else
            TrayTip("", "", 10)
            $b_Clicked = 0
        EndIf
    EndIf
    Opt("WinTitleMatchMode", $i_PrevMatchMode)
    Return $b_Clicked
EndFunc ;==>_TrayTipWait
http://www.autoitscript.com/forum/index.ph...hl=_TrayTipWait

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...