 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Stefan
Joined: 30 Jul 2004 Posts: 72 Location: Deutschland (sorry for my english)
|
Posted: Tue Oct 19, 2004 6:50 pm Post subject: iam searchnig for simple CRON command |
|
|
Hi Chris,
i searched the AHK help for an simple cron syntax.
Is there any?
Like:
AHKCron, <Minute> <Hour> <Day> <Month> <Day of Week> <Command line>
e.g.
AHKCron, 0 2 * 1-11 1-5 MsgBox, Coffee break
---
or e.g.
# start a backup every tuesday at midnight
AHKCron 0 0 * * 3 c:\tests\backup.bat
Is there such a simple syntax, i need a keyword to find this in the help.
Is this not, i wanna suggest this as new feature to use AHK as CRON.
I think about an "AHKCron.ahk" script file, containing those AHKCron commands.
THX
Stefan _________________ Stefan
This post was created with the kindly help of http://dict.leo.org/ and remember: “Allways look on the bright side of Life” |
|
| Back to top |
|
 |
Nemroth
Joined: 07 Sep 2004 Posts: 262 Location: France
|
Posted: Tue Oct 19, 2004 7:42 pm Post subject: |
|
|
I'm OK with this proposition.
Perhaps it would be better to have :
AHKCron, Day, Month, Year, Hour, Minute, Seconds, Command line
and/or
AHKCron, +Minutes, Command line
where "+Minutes" stand for the number of minutes after the lauch of the ahk script or of the compiled exe script. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Oct 19, 2004 8:15 pm Post subject: |
|
|
That's on the to-do list as "Add scheduling by extending SetTimer, e.g. daily at a certain time, etc."
I have raised its priority and made a note of your ideas for when the time comes. Thanks.
In the meantime, you could use the built-in date-time math along with SetTimer to schedule something: | Code: | #persistent
TargetTime = 1400 ; run at 2pm, which is 1400.
StringLeft, TargetDateTime, A_Now, 8 ; Put just YYYYMMDD into the variable.
TargetDateTime = %TargetDateTime%%TargetTime%
TimeUntilTarget = %TargetDateTime%
TimeUntilTarget -= %A_Now%, seconds
if TimeUntilTarget < 0
{
MsgBox The target time is already past!
ExitApp
}
TimeUntilTarget *= 1000 ; Convert to milliseconds.
SetTimer, Timer1, %TimeUntilTarget%
return
Timer1:
SetTimer, Timer1, off ; i.e. perform this subroutine only once.
; In case you want to be warned before it happens, in case it changes the
; active window or otherwise disrupts what the user is working on:
SplashTexton,,, It's about to happen.
Sleep, 3000
SplashTextOff
; And here perform whatever action you wanted scheduled:
; ...
return |
Last edited by Chris on Tue Jun 28, 2005 9:14 am; edited 1 time in total |
|
| Back to top |
|
 |
Nemroth
Joined: 07 Sep 2004 Posts: 262 Location: France
|
Posted: Tue Oct 19, 2004 8:38 pm Post subject: |
|
|
Very interesting code.
I'll keep waiting for a Cron command in AHK in the future.
Thanks Chris. |
|
| Back to top |
|
 |
Stefan
Joined: 30 Jul 2004 Posts: 72 Location: Deutschland (sorry for my english)
|
Posted: Tue Oct 19, 2004 10:49 pm Post subject: |
|
|
Thanks for the answer.
Thanks for raised its priority too.
-----------------------------------------------.
Nemroth wrotes:
> Perhaps it would be better to have :
> AHKCron, Day, Month, Year, Hour, Minute, Seconds, Command line
No, i suggest highly to use the well famliliar and well testet UNIX syntax of cron.
AHKCron <Minute> <Hour> <Day_of_the_Month> <Month_of_the_Year> <Day_of_the_Week> <command>
* * * * *
| | | | |
| | | | |
| | | | +---- Day of the Week (range: 1-7, 1 standing for Monday)
| | | +------ Month of the Year (range: 1-12)
| | +-------- Day of the Month (range: 1-31)
| +---------- Hour (range: 0-23)
+------------ Minute (range: 0-59)
<command> could be an *.exe, *.com, *.bat, *cmd, *.vbs, *.ahk ... ,
or directly an AHK command or an AHK variable who will be found
as a part of a bigger script at the end of the AHKCron.ahk file.
Click here for syntax and examples
If you need more details, let me here pls!!!
-----------------------------------------------
Further more i suggest additional commands:
1) The char +, who means execute <command> 'n' minutes or seconds
or days after windows start, depending on the position of the '+' in
command line. (THX Nemroth for this very nice idea)
2) a sixt row * for the year (like nnCron)
3) a sevent row for this following chars:
char ?, who means execute <command> during windows start.
char #, who means execute <command> on windows shutdown (not on cancling the script).
-----------------------------------------------
> In the meantime,
Thanks for pointing me to this script. _________________ Stefan
This post was created with the kindly help of http://dict.leo.org/ and remember: “Allways look on the bright side of Life” |
|
| Back to top |
|
 |
savage
Joined: 02 Jul 2004 Posts: 206
|
Posted: Mon Oct 25, 2004 11:59 pm Post subject: |
|
|
| Quote: | Nemroth wrotes:
> Perhaps it would be better to have :
> AHKCron, Day, Month, Year, Hour, Minute, Seconds, Command line
No, i suggest highly to use the well famliliar and well testet UNIX syntax of cron. |
I think nemroth's idea is probably the most appropriate. You have to consider the fact that AHK is all about simplicity and Nemroth's is certainly simpler and more natural. Also, I'm not sure how many of AHK's users would be familiar with UNIXen at all, and of those, how many of them actually know and use cron.
That being said, scheduling support would certainly be good. |
|
| Back to top |
|
 |
Wingfat
Joined: 23 Aug 2004 Posts: 193 Location: East Bay, California USA
|
Posted: Tue Oct 26, 2004 12:18 am Post subject: |
|
|
| I am useing the built in Windows Scheduler myself. I can get it to launch complied AHK scripts when I need them to. Built in function would be nice, but in essence not very necessary for most users applications. |
|
| Back to top |
|
 |
robertus Guest
|
Posted: Tue Jan 25, 2005 10:46 pm Post subject: |
|
|
maybe you should think about introducing a bit more than just cron.
I am familiar with a shareware called "Macro Angel" which has good scheduling features (but some of the macro stuff sucks) - when you worked with that you know there is more to it than just a cron-command:
for example what should happen to the script when it failed - should it be rescheduled for next week, or disabled?
Also the scheduler should log when the script was execute in the past (plus results?). for example: a script that is due every monday and you turn on your computer and it is tuesday and the day before you had a holiday. There should be a feature saying: test if the script is/was due. if it is overdue:
a.) run it right away and reschedule it for next monday (tuesday?)
b.) ask what to do
c.) don't bother just wait for next monday |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Tue Jan 25, 2005 11:44 pm Post subject: |
|
|
| Thanks for the ideas. I've made a note to review them again when the time comes to work on this feature. |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Feb 03, 2005 3:42 am Post subject: my two cents worth |
|
|
The time should be in the already establisted format used by other commands...
The elements of the YYYYMMDDHH24MISS format are:
YYYY The 4-digit year
MM The 2-digit month (01-12)
DD The 2-digit day of the month (01-31)
HH24 The 2-digit hour in 24-hour format (00-23) e.g. 09 is 9am, 21 is 9pm
MI The 2-digit minutes (00-59)
SS The 2-digit seconds (00-59)
If only a partial string is given for YYYYMMDDHH24MISS (e.g. 200403), any remaining element that has been omitted will be supplied with the following default values:
MM: Month 01
DD: Day 01
HH24: Hour 00
MI: Minute 00
SS: Second 00
The built-in variable A_Now contains the current local time in the above format. |
|
| Back to top |
|
 |
Stefan
Joined: 30 Jul 2004 Posts: 72 Location: Deutschland (sorry for my english)
|
Posted: Fri Aug 24, 2007 12:45 pm Post subject: |
|
|
Hi Chris,
are there any news about an intern cron functionality?
This would be quit simpler then Timer / Sleep / IFs
| Code: | #SingleInstance force
;every two working hours on Mo-Fr
CRON * 10,12,14,16 * * 1-5
(
MsgBox What have you done till now?
Run worksheet.xls
some AHK code here
)
Return |
Reminder:
> Chris Posted: Tue Oct 19, 2004 9:15 pm
> That's on the to-do list as "Add scheduling by extending SetTimer,
> e.g. daily at a certain time, etc."
Thanks _________________ Stefan
This post was created with the kindly help of http://dict.leo.org/ and remember: “Allways look on the bright side of Life” |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Mon Aug 27, 2007 11:46 pm Post subject: |
|
|
| Yes, it's still planned. I consider scheduling to be a pretty big benefit that would be used by quite a few people. |
|
| Back to top |
|
 |
tonne
Joined: 06 Jun 2006 Posts: 1163 Location: Denmark
|
Posted: Tue Aug 28, 2007 7:32 am Post subject: |
|
|
FYI
I am currently working on a script offering cron capabilities.
It will be packeted in two parts: a library and a standalone interface using the library.
I hope the library will be ready in the end of this week (ultimo august 07 ). The interface some weeks later.
EDIT:
The first beta version is out: http://www.autohotkey.com/forum/viewtopic.php?p=143772#143772 _________________ there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face
- Kashmir |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|