AutoHotkey Community

It is currently May 27th, 2012, 6:57 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: MM Cron
PostPosted: February 10th, 2006, 8:44 am 
Offline

Joined: July 22nd, 2005, 7:36 am
Posts: 52
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 14th, 2006, 4:48 am 
Offline

Joined: February 13th, 2006, 10:40 pm
Posts: 389
Location: Utah
Very nice program! Well laid out, easy to understand.

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

_________________
Image
"Power can be given overnight, but responsibility must be taught. Long years go into its making."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 14th, 2006, 7:59 am 
Offline

Joined: July 22nd, 2005, 7:36 am
Posts: 52
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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 16 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group