Access Violation in module 'js32.dll' when you add too many files.

Advanced Renamer forum
#1 : 23/02-20 22:00
Peter
Posts: 5
Hi,
as mentioned in my other topic, when I add images to rename in AR 3.85, I get the error:

"Access violation at address 6328F7B5 in module 'js32.dll'. Read of address 02C2F77C."

when I add "too many" files. "Too many" may be more than 12 with some files, or just more than 4 with others.

When it throws this error, the file seem to be in the list, but they are "invisible".
I have a folder with 7 files in it. When I have AutoTest enabled and add more than 3 files at once, it throws the error.
When I have AutoTest disabled, it works fine. Even when I throw in all 7 files at once.
But when I try to TestBatch, it throws the same error, but the files don't disappear.

Is there a known cause and fix for this problem?
#2 : 24/02-20 18:43
Peter
Posts: 5
Reply to #1:

An interesting observation:

When I add a folder with "Auto Test" disabled and click on "Test Batch", I get the error.

But when I add a folder, then open the "Metadata" window at the top, close it again and click on "Test Batch" afterwards, everything works fine.
#3 : 25/03-20 01:19
Jake
Posts: 1
I want to bump this. I just dropped $20 on this tool and it seems great. I am getting this bug 100% of the time when running my script on my batch of ~500 photos. It looks for the oldest date associated with a photo and rename it.

Here is the script:
```
try {
var uniqueFileName = function (str) {
return str + "___" + item.name + "___";
};

var isValidStr = function (str) {
return (str != null) && (str.length > 0);
};

var pad = function (n, width, z) {
z = z || '0';
n = n + '';
return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
}

var parseDate = function (str) {
var dateStr = str;

// Replace date with - instead of :
if ((dateStr.match(/:/g) || []).length >= 4) {
dateStr = dateStr.replace(':', '-').replace(':', '-')
}

// Replace date with - instead of .
if ((dateStr.match(/./g) || []).length >= 2) {
dateStr = dateStr.replace('.', '-').replace('.', '-')
}

// Add T in there
dateStr = dateStr.replace(' ', 'T');

var newDate = new Date(dateStr);
if (newDate == NaN) {
console.log("Bad date found: " + dateStr)
return null;
}

if (newDate == "Invalid Date") {
return null;
}

return newDate;
}

var dates = [];

var dateTimeOriginal = item.exifToolValue('DateTimeOriginal');
if (isValidStr(dateTimeOriginal)) {
console.log('DateTimeOriginal');

var date = parseDate(dateTimeOriginal);
if (date != null) {
dates.push(date);
}
}

var mediaCreationTime = item.exifToolValue('MediaCreateDate');
if (isValidStr(mediaCreationTime)) {
console.log('MediaCreateDate');

var date = parseDate(mediaCreationTime);
if (date != null) {
dates.push(date);
}
}

var creationDate = item.exifToolValue('CreationDate');
if (isValidStr(creationDate)) {
console.log('CreationDate');

var date = parseDate(creationDate);
if (date != null) {
dates.push(date);
}
}

if (item.modifiedDate) {
dates.push(item.modifiedDate);
}


// Find the oldest date possible from all attributes
var smallestDate = null;
dates.forEach(function (date) {
if (smallestDate == null) {
smallestDate = date;
}
else if (date == null) {
console.log("O NO ITS NULL");
}
else if (date.valueOf() < smallestDate.valueOf()) {
smallestDate = date;
}
});

if (smallestDate) {
var dateStr = pad(smallestDate.getFullYear(), 4) + "." +
pad(smallestDate.getMonth() + 1, 2) + "." +
pad(smallestDate.getDate(), 2) + "_" +
pad(smallestDate.getHours(), 2) + "." +
pad(smallestDate.getMinutes(), 2) + "." +
pad(smallestDate.getSeconds(), 2);

return uniqueFileName(dateStr);
}
else {
return "BAD_FILE_ATTRIBUTES";
}
}
catch (err) {
return "JSError: " + err;
}
```