Page 1 of 2 1 2 >
Topic Options
#58 - 01/09/01 05:06 AM Bad date format
Anonymous
Unregistered


Hello,

I get an error message "Bad date format -time 9:00:00 AM". See my script below.

{
-name Send_monday
-start -time 9:00:00 AM
-skip -week 1,3,4,5,6,7
-action -onerror mon_operation_fail
-action -print logon to email. This may take a moment...
-action -mail Logon myHandle %EMAIL_PROFILE%
-action -print sending an email
-action -mail SendMail akumo@yahoo.com "Data of monday" "Auto send mail from system." "h:\mon\daily"
-action -print logoff from email
-action -mail Logoff myHandle
-action -print done!
}

If i change to "-start -time 9:00:00AM", it work but it run immediately not wait for 9:00 AM. How can i make it work ?

Top
#59 - 01/09/01 09:43 AM Re: Bad date format
Luke Tomasello Administrator Offline
Member

Registered: 09/17/00
Posts: 740
Loc: San Jose, CA., USA
I think if you go to your Regional Settings in the Control Panel, you will find that your system is set up 24 hour clock.

This is why WinCron is complaining about the 'AM'. When you leave out the space and have 9:00:00AM, the AM is simply ignored.

To make this work, you need to do two things:
1. Enter the time in proper 24 hour time. If you want 9 AM, then it would be 9:00:00.
2. add the constrain directive to keep the time trigger from firing too soon.

Example:
-start -time 9:00:00 -constrain 0 0 5 0

You see, when you run the script at say 12 noon, the trigger is 'past due', that's why it fires. The -constrain directive tells WinCron to only fire upto 5 minutes past the specified time.
_________________________
Regards,
Luke Tomasello

Top
#60 - 01/09/01 05:15 PM Re: Bad date format
Anonymous
Unregistered


Hi,

Sorry for disturbing you again, after i put constrain as you show me.
"-start -time 9:00:00 -constrain 0 0 5 0"
It still fire my work immediately. Did i do something wrong ?

Top
#61 - 01/09/01 05:22 PM Re: Bad date format
Anonymous
Unregistered


Message from console show below.

Loading mail Service...
WinCron MAIL version 1.0 BETA 1
-+-+-+-+-+-+-+-+
Config.tg: Environment setup complete.
Loading C:\Program Files\Tomasello Software\WinCron\Scripts\mon.tg.
2 jobs loaded.
logon to email. This may take a moment...
sending an email
logoff from email
done!

Top
#62 - 01/09/01 05:33 PM Re: Bad date format
Luke Tomasello Administrator Offline
Member

Registered: 09/17/00
Posts: 740
Loc: San Jose, CA., USA
Okay, give me the exact script as you have it now and I will try it here.

It seems to be working on my system correctly. However, I see in your mon.tg there are TWO jobs. I would like to see both so I can diagnose the problem.

Thanks.

[This message has been edited by Luke Tomasello (edited 01-09-2001).]
_________________________
Regards,
Luke Tomasello

Top
#63 - 01/09/01 06:16 PM Re: Bad date format
Anonymous
Unregistered


Hi Luke,

Thank you very much. Now it work. My mistake is i have a script name "sched.tg" that load "mon.tg", "tue.tg",.... "fri.tg" before i used "-action -load " i have "-start" command at the first line of "sched.tg".

Have a nice day,
/Akumo

Top
#64 - 01/09/01 06:39 PM Re: Bad date format
Luke Tomasello Administrator Offline
Member

Registered: 09/17/00
Posts: 740
Loc: San Jose, CA., USA
Great, I'm glad it's working.

Be sure to check out this sample where we use macros to select the daily script to run: http://www.tomasello.com/ubb/Forum4/HTML/000006.html
_________________________
Regards,
Luke Tomasello

Top
#65 - 01/10/01 08:58 AM Re: Bad date format
Luke Tomasello Administrator Offline
Member

Registered: 09/17/00
Posts: 740
Loc: San Jose, CA., USA
By the way,
I don't see a:
-action -inc directive, so I don't know if your script will recure like you expect (unless you have that in the 'main' script.)

If that is the case, you should then have a -stop in this script so that it gets removed from memory.
_________________________
Regards,
Luke Tomasello

Top
#66 - 01/16/01 06:41 PM Re: Bad date format
Anonymous
Unregistered


Hello,

Could you please check my script ? They can load with no error but have no action fire out. That i want this script do is like cron on UNIX machine.

1. eis.tg
{
-name EIS.TG
# Load old style .TAB file for backwards compatibility.
-start
-action -inc 1 0 0 0
-action -load "%TG.ROOT_DIR%mon.tg"
-action -load "%TG.ROOT_DIR%tue.tg"
-action -load "%TG.ROOT_DIR%wed.tg"
-action -load "%TG.ROOT_DIR%thu.tg"
-action -load "%TG.ROOT_DIR%fri.tg"
-action -print EIS.TG: Complete.
}

2. mon.tg (same as tue, wed, ..., fri)
# Send an email of EIS' data for monday
{
-name Send_EIS_monday
-start -time 9:00:00 -constrain 0 0 5 0
-skip -week 1,3,4,5,6,7
-action -onerror mon_operation_fail
-action -print logon to email. This may take a moment...
-action -mail Logon myHandle %EMAIL_PROFILE%
-action -print sending an email
-action -mail SendMail akumo@yahoo.com "EIS data of monday" "Auto send mail from EIS system." "h:\eis\mon\daily"
-action -print logoff from email
-action -mail Logoff myHandle
-action -print done!
}

# operation failed
{
-name mon_operation_fail
-action -print mail of monday failed with error:
-action -print %TG.LAST_ERROR%
-action -return abort
}

Top
#67 - 01/16/01 07:44 PM Re: Bad date format
Luke Tomasello Administrator Offline
Member

Registered: 09/17/00
Posts: 740
Loc: San Jose, CA., USA
Here you go!
This version is a bit Simpler than the one you created, but I have had a lot of practice!
I think this will work fine for you.
The only thing you need to be careful of, is to make sure that "h:\eis\%DAY%\daily" exists.
The %DAY% macro expands into the ‘correct’ day abbreviation used by the operating system.
The correct names are as follows: Mon, Tue, Wed, Thu, Fri, Sat, Sun.
(This is on a US English machine)

## Main program
# Everyday at 9AM, except SAT and SUN
# send EIS mail specific for that day
{
-name EIS.TG

# Everyday at 9AM
-start -time 9:00:00 -constrain 0 0 5 0

# except SAT and SUN
-skip -week 1,7

# CALL Send_EIS_mail to send mail, mon - fri
-action -call Send_EIS_mail

# print status
-action -print EIS.TG: Complete.

# do this again tomorrow
-action -inc 1 0 0 0
}

# Subroutine to Send an email of EIS' data for 'today'
{
-name Send_EIS_mail
-action -onerror operation_fail
-action -print logon to email. This may take a moment...
-action -mail Logon myHandle %EMAIL_PROFILE%
-action -print sending an email
-action -print Reading data file from "h:\eis\%DAY%\daily"
-action -mail SendMail akumo@yahoo.com "EIS data of %A%" "Auto send mail from EIS system." "h:\eis\%DAY%\daily"
-action -print logoff from email
-action -mail Logoff myHandle
-action -print done!
}

# operation failed
{
-name operation_fail
-action -print mail of %A% failed with error:
-action -print %TG.LAST_ERROR%
-action -return abort
}
_________________________
Regards,
Luke Tomasello

Top
Page 1 of 2 1 2 >


Moderator:  Luke Tomasello