I’m not sure if there is another way of doing it, but I use regex. I’ve tried it a few other ways with no success.
Now I’ve not tested below out, but with my plugin this works.
your script with amend
var importVideoExtension = (/\.(mp4|mpg)$/i);
var a = Folder(filePath);
if(a != null){
var b = a.getFiles(importVideoExtension);
var c = b.length;
for(var i = 0; i < c; i++){
imported[i] = importAFile(b[i]);
imported[i].parentFolder = footage;
}
}
my script that works incase you can you modify this if the above doesn’t work.
var file_type = (/\.(mp4|mp3)$/i);
var sourceFolder = Folder.selectDialog(“Select folder with source files”);
var sourceFiles = sourceFolder.getFiles(file_type);
var footage;
for (var i = 0; i < sourceFiles.length; i++) {
footage = app.project.importFile(new ImportOptions(sourceFiles[i]));
}