Problem with script set item.newModifiedDate

Advanced Renamer forum
#1 : 27/04-14 22:31
Andreas Leipold
Andreas Leipold
Posts: 1
Hi,

I wrote a script and create my own date object. After that a want to set lastModifiedDate of my jpg file to this date. This don't work for me. The modifiedDate of my file isn't changed it's just the original one.

Here my script:

var dateString = item.filename;
var reggie = /(\d{4})-(\d{2})-(\d{2})_(\d{2})-(\d{2})/;
var dateArray = reggie.exec(dateString);
var dateObject = new Date(
(+dateArray[1]),
(+dateArray[2])-1, // Careful, month starts at 0!
(+dateArray[3]),
(+dateArray[4]),
(+dateArray[5]),
0
);

item.newModifiedDate = dateObject;

Thanks in advance!
Andreas


27/04-14 22:31
#2 : 04/05-14 21:34
Kim Jensen
Kim Jensen
Administrator
Posts: 775
Reply to #1:
Instead of using the script method use the timestamp method click thew Apply to Modified date and time check box and set the Filename pattern radio button. Use this pattern in the text box:
<Year>-<Month>-<Day>_<Hour>-<Min>

This will read the timestamp from the filename and apply it to the modified file time.


04/05-14 21:34