I don't know that I reduce the flicker, but try these changes to your script.
Code: Select all
#SingleInstance
#Include Timer.ahk
Gui +AlwaysOnTop -MaximizeBox -Resize -MinimizeBox
Gui, Color, 000000
Gui, Font, s14 cblack, Verdana
Gui, Add, Text, vToResolve center w230 y-20, () ; why did 'dalborgo' have this line
;Gui, Add, Text, vToResolve center w230 y0, () ; dinno
Gui, Font, s24 cgray, Verdana
;WS_CLIPSIBLINGS (0x4000000)
Gui, Add, Text, vClock center -0x4000000 w230 yp+28, 00:00
; Gui, Add, Text, vClock center w230 yp+28, 00:00
;Gui, Show, W260 H230 x2400 y-200, Tavoli
Gui, Show, W260 H230 , Tavoli
Timer("TEST",0)
#Persistent
;SetTimer, cycle, 10 ; much too often
SetTimer, cycle, 100
return
cycle:
;Loop{ ; the loop makes the update happen continuously and very rapidly, bad idea
msec:= Timer("TEST","E")
sec:=Floor(msec /1000)
tim:= SecToHHMMSS(sec)
giuv:=Mod(msec, 1000) ; why?
if (prev_msec = msec) ; the previous pass had the same value as this, don't bother updating
return
; Gui, Font, cblack
; GuiControl,Font, ToResolve ; why are you updating the color of an unused control?
; if (giuv == 0)
GuiControl, -Redraw, clock
GuiControl,, clock, % tim
GuiControl, +Redraw, clock
prev_msec :=msec ; this forwards the currrent value on to the next pass for comparison
;} ; donpt need or want the loop
return ; normal end of a settimer subroutine
SecToHHMMSS(Sec) {
OldFormat := A_FormatFloat
SetFormat, Float, 2.0
Hrs := Sec//3600/1
SetFormat, Float, 02.0
Min := Mod(Sec//60, 60)/1
Sec := Mod(Sec,60)/1
SetFormat, Float, %OldFormat%
Return (Hrs ? Hrs ":" : "") Min ":" Sec
}