JS Type Error: Not a function

Can anyone help explain why my script has stopped working?

I've finally moved to Windows 11 and done a fresh install of v4.24 but now my old reliable script just says "Invalid script: TypeError: not a function"

All I need it to do is put the timestamp at the front of the name so all my photos sort correctly and don't clash when default names cycle round.

I doubt this is the best way to do it but I needed it to work on any image file I give it, whether photograph, screenshot, HEIC, PNG, JPG etc.

Any help would be greatly appreciated.


var allDates = [];
var dateTags = ["DateTimeOriginal","FileModifyDate","FileCreateDate","CreateDate","ModifyDate","TrackCreateDate","TrackCreateDate","MediaCreateDate","MediaModifyDate","CreationDate"];

for(i=0; i<dateTags.length; i++){
var newDate = item.exifToolValue(dateTags[i]);
if (newDate !== ""){
newDate = newDate.toString().substring(0, 19);
newDate = newDate.replace(/:|-/gi,".");
if(newDate != "0000.00.00 00.00.00"){
allDates.push(newDate);
}
}
}

allDates.sort();
var newName = allDates[0] + " - " + item.newBasename;
newName = newName.replace("..... ","");
newName = newName.replace("......","");

return newName;
Reply to #1:

Hi ad,

Try changing item.exifToolValue to app.exifToolValue

I *think* that's the problem.

Best,
DF