Code: Select all
#SingleInstance, force
#persistent
#WinActivateForce
SetWorkingDir %A_ScriptDir%
activeICO := "active.ico"
TimerICO := "timer.ico"
a:
Menu,Tray,Icon,%activeICO%
Menu,Tray, NoStandard
Menu, Tray, Tip, Timer
DetectHiddenWindows, On
SETTIMER, settttimer, 50
settttimer:
sleep 100
if Winexist("ahk_exe firefox.exe")
{
if A_TimeIdle > 0
Loop
{
initSecs := 600
Menu,Tray,Icon,%TimerICO%
Gui, 99:+AlwaysOnTop
Gui, 99:font,s8 q4 bold,Verdana
Gui, 99: +Caption -border -sysmenu +ToolWindow +LastFound
Gui, 99:add, text, x10 y5 w66 h17 vTX , %initSecs%
Gui, Color, 000000
WinSet, Transparent, 200
Gui, 99:Show,x1185 y642, remaining
loop % initSecs-1
{
SETTIMER, ab, 500
GuiControl,99:,TX,% Frmt(--initSecs)
sleep, 1000
SETTIMER, ab, 500
if A_TimeIdle < 2000
{
check()
Gui, 99:Destroy
Menu,Tray,Icon,%activeICO%
Gui, 99:Destroy
goto, a
}
SETTIMER, ab, 500
}
Gui, 99:Destroy
loop,5
{
if A_TimeIdle < 2000
{
Gui, 99:Destroy
goto, a
}
SETTIMER, ab, 500
Process, Close, firefox.exe
goto, a
return
}
Gui, 99:Destroy
DetectHiddenWindows, on
Return
Gui, 99:Destroy
Frmt(secs)
{
time = 20000101
time += %secs%, seconds
FormatTime, mmss, %time%, mm:ss
return mmss
}
}
}
And I want to create script that will start cutdown timer if idle.
if idle for 30 sec ⟶ I get notified that it has been idle for 30 sec
if 60, 2000, 600000 sec idle ⟶ I get notified that is has been idle for 60, 2000, 600000 correspondingly
But if I move it disappear
I cannot finirh the scipt. The Timer.ico don't change to active sometimes. And my attempts to create 60, 2000, 600000 sec notification without pausing the script failed.
I would be extremely happy if you helped me