Date not updating?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
ADP_MAN
Junior Coder
Posts: 45
Joined: Wed Apr 07, 2004 2:04 pm

Date not updating?

Post by ADP_MAN » Tue May 12, 2015 2:36 pm

Hi All,

I would like to add a date to the file name and I'm using the simple script:

Day>Day
Month>Month
Year>Year
Let>todayDate=%Year%%Month%%Day%
.
.
.
.
MoveFile>T:\temp\file.txt,T:\temp\file_%todayDate%.txt


I've never had an issue when the script was "launched" as an .exe from a program. In this case the script is always on and watching a folder for a specific file to load before working. The file WILL add the correct date the first time, then use the same date the following day.

Example Result:
Day 1 (May 12, 2015)
file_20150512.txt

Day 2 (May 13, 2015)
file_20150512.txt


Is there a command that needs to "reset" the script so it knows a new day has occured? If I stop the script and re-start, I will once again get the corect date.

**Note: I have not run the script past two days to see the next days result

Thanks,
Dom

User avatar
Djek
Pro Scripter
Posts: 148
Joined: Sat Feb 05, 2005 11:35 pm
Location: Holland
Contact:

Re: Date not updating?

Post by Djek » Tue May 12, 2015 5:03 pm

hey Dom,

seems to me that
Day>Day
Month>Month
Year>Year
Let>todayDate=%Year%%Month%%Day%
must be on a position in the script AFTER you notice that there s a new file in the folder.

The only reason that the date isnt refreshed, is because the date is init once, at the beginning of the script.
Perhaps you can put the whole script here, so we can see the loops and labels.
kind regards
Djek

ADP_MAN
Junior Coder
Posts: 45
Joined: Wed Apr 07, 2004 2:04 pm

Re: Date not updating?

Post by ADP_MAN » Tue May 12, 2015 7:51 pm

Ok - I didnt have the date calculation inside my checking loop, so it was never able to get the new information.

Thanks!
Dom

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts