### ToolTip duration problem

Posted:

**28 Mar 2019, 03:40**I have a problem with the duration of a tooltip.

ToolTip,% A_LineNumber

Sleep,3000 ; time for reading

These should actually be readable for three seconds but are gone immediately.

ToolTip,% A_LineNumber

Sleep,3000 ; time for reading

These should actually be readable for three seconds but are gone immediately.

Code: Select all

```
SetTitleMatchMode,2
DetectHiddenWindows,On
token = 1903280913
while(1){
ToolTip2sec( token " : 2 seconds `n(" A_ThisFunc " " RegExReplace(A_LineFile,".*\\") ":" A_LineNumber ")",1,1 )
Sleep,1900
IfWinNotExist,% token
{
ToolTip,% A_LineNumber
SoundBeep,5000
MsgBox,262160,% ":(`n" A_ThisFunc ":" A_LineNumber " " RegExReplace(A_LineFile, ".*\\") ,% ":(`n(" A_ThisFunc ":" A_LineNumber " " RegExReplace(A_LineFile, ".*\\") ")"
}else{
ToolTip,% A_LineNumber
; SoundBeep,8000
}
Sleep,3000 ; time for reading
Sleep,300
IfWinExist,% token
{
ToolTip,% A_LineNumber
SoundBeep,5000
MsgBox,262160,% ":(`n" A_ThisFunc ":" A_LineNumber " " RegExReplace(A_LineFile, ".*\\") ,% ":(`n(" A_ThisFunc ":" A_LineNumber " " RegExReplace(A_LineFile, ".*\\") ")"
}else{
ToolTip,% A_LineNumber
; SoundBeep,8000
}
Sleep,3000 ; time for reading
Reload
}
RemoveToolTip_level2(){
ToolTip, , , , 2
RemoveToolTip_level2Obj := Func("RemoveToolTip_level2")
SetTimer % RemoveToolTip_level2Obj, , Off
return
}
;/¯¯¯¯ ToolTipSec ¯¯ 190110154314 ¯¯ 10.01.2019 15:43:14 ¯¯\
ToolTipSec(t,x=123,y=321,sec=1000,layer1to20:=1) {
Last_A_This:=A_ThisFunc . A_ThisLabel
; lll(A_LineNumber, "ToolTipSec.inc.ahk",Last_A_This)
MouseGetPos,xMouse,yMouse
; t := regexReplace(t,",",".") ;
; t := regexReplace(t,"+","#") ;
if( x=123 AND y=321 )
{
ToolTip, %t% , 0, % yMouse + 10, layer1to20
; lll(A_LineNumber, "ToolTipSec.inc.ahk")
}
else
{
; lll(A_LineNumber, "ToolTipSec.inc.ahk")
if(abs(yMouse - y ) < 90 ){
y := ( y < 500 ) ? (y+150) : (y-150)
}
ToolTip, %t%,%x%,%y%, layer1to20
;~ MsgBox,ToolTip %t% %x% %y%
;
}
; http://www.autohotkey.com/board/topic/81732-try-catch-doesnt-work/
;~ .. but here's how to suppress load-time "function not found" errors:
blank := ""
;~ commaBlank := ", "
;~ if(isFunc("RemoveToolTip") )
;~ RemoveToolTip%blank%( sec )
; SetTimer,RemoveToolTip%layer1to20%,%sec%
; SetTimer,RemoveToolTip_level%layer1to20%,%sec%
RemoveToolTip_level1Obj := Func("RemoveToolTip_level" layer1to20)
; pause
SetTimer, % RemoveToolTip_level1Obj, ,Off
;~ kkk
;~ RemoveToolTip( sec )
;~ ; jj
;~ empty:="Timer"
;~ Set%empty%,
return
}
;\____ ToolTipSec __ 190328093749 __ 28.03.2019 09:37:49 __/
ToolTip1sec(t,x=123,y=321, layer1to20:=1){
Last_A_This:=A_ThisFunc . A_ThisLabel
;~ lll(A_LineNumber, "ToolTipSec.inc.ahk",Last_A_This)
ToolTipSec(t,x,y,1000, layer1to20)
return
}
ToolTip2sec(t,x=123,y=321, layer1to20:=1){
Last_A_This:=A_ThisFunc . A_ThisLabel
;~ lll(A_LineNumber, "ToolTipSec.inc.ahk",Last_A_This)
ToolTipSec(t,x,y,2000, layer1to20)
return
}
ToolTip3sec(t,x=123,y=321, layer1to20:=1){
Last_A_This:=A_ThisFunc . A_ThisLabel
;lll(A_LineNumber, "ToolTipSec.inc.ahk",Last_A_This)
ToolTipSec(t,x,y,3000, layer1to20)
return
}
ToolTip4sec(t,x=123,y=321, layer1to20:=1){
Last_A_This:=A_ThisFunc . A_ThisLabel
;lll(A_LineNumber, "ToolTipSec.inc.ahk",Last_A_This)
ToolTipSec(t,x,y,4000, layer1to20)
return
}
ToolTip5sec(t,x=123,y=321, layer1to20:=1){
ToolTipSec(t,x,y,5000, layer1to20)
Last_A_This:=A_ThisFunc . A_ThisLabel
lll(A_LineNumber, "ToolTipSec.inc.ahk",Last_A_This)
return
}
ToolTip6sec(t,x=123,y=321, layer1to20:=1){
ToolTipSec(t,x,y,6000, layer1to20)
Last_A_This:=A_ThisFunc . A_ThisLabel
lll(A_LineNumber, "ToolTipSec.inc.ahk",Last_A_This)
return
}
ToolTip7sec(t,x=123,y=321, layer1to20:=1){
ToolTipSec(t,x,y,7000, layer1to20)
Last_A_This:=A_ThisFunc . A_ThisLabel
lll(A_LineNumber, "ToolTipSec.inc.ahk",Last_A_This)
return
}
ToolTip8sec(t,x=123,y=321, layer1to20:=1){
ToolTipSec(t,x,y,8000, layer1to20)
Last_A_This:=A_ThisFunc . A_ThisLabel
lll(A_LineNumber, "ToolTipSec.inc.ahk",Last_A_This)
return
}
;/¯¯¯¯ ToolTip9sec ¯¯ 190110154202 ¯¯ 10.01.2019 15:42:02 ¯¯\
ToolTip9sec(t,x=123,y=321, layer1to20:=1){
ToolTipSec(t,x,y,9000, layer1to20)
Last_A_This:=A_ThisFunc . A_ThisLabel
lll(A_LineNumber, "ToolTipSec.inc.ahk",Last_A_This)
return
}
;\____ ToolTip9sec __ 190110154205 __ 10.01.2019 15:42:05 __/
```