Problem with script set item.newModifiedDate

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

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[2])-1, // Careful, month starts at 0!

item.newModifiedDate = dateObject;

Thanks in advance!

27/04-14 22:31
#2 : 04/05-14 21:34
Kim Jensen
Kim Jensen
Posts: 804
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:

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

04/05-14 21:34