/* AutoHotkey Version: 2.x This AutoHotkey script uses version 2.0 functions and won't run under version 1.1. The .ahk2 file extension denotes all V2.0 scripts and can be compared to the sister 1.1 scripts with the .ahk extension. For more information about how to run both V1.1 and V2.0 simultaneously, see: https://jacksautohotkeyblog.wordpress.com/2018/01/11/how-to-fool-around-with-the-new-autohotkey-version-2-0/ */ ; AutoHotkey Version: 2.x ; ; ; Script Function: AutoHotkey 2.0 Version of EggTimer ; ; #SingleInstance Gui := GuiCreate() EggTimer := Array() Gui.SetFont("s20") Gui.Title := "Egg Timer" Minutes := Gui.Add("Edit","w60 number right ReadOnly vMinutes") Gui.Add("UpDown","Range0-59 wrap","3") Gui.Add("Text","ys","Minutes") Seconds := Gui.Add("Edit","w60 ys number right ReadOnly vSeconds") Gui.Add("UpDown","Range0-59 wrap","0") Gui.Add("Text","ys","Seconds") Gui.Add("Progress","w400 h20 xs vMyProgress") Gui.Add("Button","section","Start").OnEvent("Click","ButtonStart") ^F12:: Gui.Show Return ButtonStart() { Global EggTimer := Gui.Submit(0) ;For index, element in EggTimer ; MsgBox "Element number " . index . " is " . element TotalSec := (EggTimer["Minutes"]*60+EggTimer["Seconds"]) StopTime := A_TickCount + (TotalSec*1000) Loop { Sleep 1000 TimeLeft := (StopTime - A_TickCount)/1000 ProgressBar := 100-(TimeLeft/TotalSec*100) If TimeLeft >= 0 { Minutes.Value := Floor(TimeLeft/60) Seconds.Value := Round(Mod(TimeLeft,60)) } Gui.Control["MyProgress"].Value := Round(ProgressBar) If (A_TickCount >= Stoptime) { Break } } SoundBeep 600,3000 Sleep 3000 ComObjCreate("SAPI.SpVoice").Speak("Your eggs are ready!") MsgBox("Your eggs are ready!", "Egg Timer","4096") }