(using it on my job)
; MM-Cron V1.0 ; ; Syntax : MM-Cron <Time in Min.> <Program to execute> <Window Title> <X Position> <Y Position> <RW> ; If RW is supplied then the cron waits till the program to execute has ended. ; ; ; 2005, Andre #Persistent #SingleInstance off #NoTrayIcon If A_IsCompiled { ; Exit when not enough parameters..... If 0 < 5 { MsgBox,,, Syntax : MM-Cron <Time in Min.> <Program to execute> <Window Title> <X Position> <Y Position> <RW>,5 ExitApp } } Tijd = %1% Program = %2% Title =%3% Xpos = %4% YPos = %5% RunW = Upper(%6%) If Not A_IsCompiled ;just for testing { Tijd = 1 Program = cmd.exe Title = hallo Xpos = 100 Ypos = 100 RunW = RW } MaxProgress := Tijd * 60 TijdToGo := Tijd * 60000 SetTimer, CountDown, 1000 Gui, Add, Progress, w150 h20 cBlue vMyProgress Gui, Add, Text,, Interval : Gui, Add, Text, w50 xp+50 VInterval Gui, Add, Text,xs, To go : Gui, Add, Text, w50 xp+50 VTimeToGo Gui, Add, Button, GRunNow xs w75, &Run Now Gui, Add, Button, GExitNow xp+75 w75, &Exit ;Gui, -MinimizeBox Gui, Show,X%Xpos% Y%Ypos% , %Title% GuiControl, +Range0-%MaxProgress%, MyProgress Return RunNow: SetTimer, CountDown, Off If RunW = RW RunWait, %Program% Else Run, %Program% SetTimer, CountDown, On TijdToGo := Tijd * 60000 GuiControl,, MyProgress, 0 Return ExitNow: GuiClose: ExitApp CountDown: EnvSub, TijdToGo, 1000 GuiControl,, MyProgress, +1 GuiControl,, Interval, %Tijd% min. TimeTemp := TimeLog(TijdToGo/1000) GuiControl,, TimeToGo, %TimeTemp% If TijdToGo <= 0 { SetTimer, CountDown, Off If RunW = RW RunWait, %Program% Else Run, %Program% SetTimer, CountDown, On TijdToGo := Tijd * 60000 GuiControl,, MyProgress, 0 } Return ;Function to convert seconds in to hh:mm:ss format ;T1 = value in seconds TimeLog(T1) { SetFormat, FLOAT, 02.0 S := Mod(T1,60) + 0.0 M := Mod((T1-S)/60,60) H := ((T1-S)/60 - M)/60 return H . ":" . M . ":" . S }
Feel free to give suggestions/improvements.....
Andre