AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MM Cron

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Andre



Joined: 22 Jul 2005
Posts: 52

PostPosted: Fri Feb 10, 2006 7:44 am    Post subject: MM Cron Reply with quote

Simple Cron utility to run some things.
(using it on my job)

Code:
; 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
Back to top
View user's profile Send private message
Veovis



Joined: 13 Feb 2006
Posts: 390
Location: Utah

PostPosted: Tue Feb 14, 2006 3:48 am    Post subject: Reply with quote

Very nice program! Well laid out, easy to understand.

Can't imagine what I (or you) would use it for though...
_________________

"Power can be given overnight, but responsibility must be taught. Long years go into its making."
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Andre



Joined: 22 Jul 2005
Posts: 52

PostPosted: Tue Feb 14, 2006 6:59 am    Post subject: Reply with quote

Hi,

Thnx for the comment.

Here on my job we use it to schedule various scripts running on an server.
Wenn i look through the window (serverroom) behind me i can see in one look the status of it.......

Andre
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group