Automate the process of importing an entire folder
I'm looking for a way to automate the process of importing an entire folder with a sequence of files into Adobe After Effects, Sadly i'm no way near to get this worked
Here is the code i was working with but no luck
// Define the folder path to import files from
var folderPath = "My folder/Path";
// Create a File object for the folder
var folder = new Folder(folderPath);
// Check if the folder exists
if (folder.exists) {
// Get a list of all files in the folder
var fileList = folder.getFiles();
// Create a new project
var project = app.project;
// Create a new composition
var compWidth = 1920; // Adjust the width as needed
var compHeight = 1080; // Adjust the height as needed
var compDuration = fileList.length / 30; // Assuming 30 frames per second
var newComp = project.items.addComp("Image Sequence", compWidth, compHeight, 1.0, compDuration, 30); // Composition name, width, height, pixel aspect ratio, duration, frame rate
// Import the image sequence into the composition
for (var i = 0; i < fileList.length; i++) {
var file = fileList[i];
if (file instanceof File && file.name.match(/\.(png|jpg|jpeg|gif|tiff|tif|bmp)$/i)) {
var importOptions = new ImportOptions(file);
var importedFootage = project.importFile(importOptions);
if (importedFootage) {
newComp.layers.add(importedFootage);
}
}
}
if (newComp.layers.length > 0) {
// Alert the user that the import is complete
alert("Image sequence imported successfully!");
} else {
alert("Failed to import the image sequence.");
}
} else {
alert("Folder not found: " + folderPath);
}
Adobe as included this feature in updated version to import the folder but still its unable to call it as footage, this something i was working for a while to automate this process since my daily task is to handle a lot of passes its quite time taking going back and fourth to import the sequence manually.
