• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Extendscript Help

New Here ,
Mar 08, 2024 Mar 08, 2024

Copy link to clipboard

Copied

Can someone tell me why this won't work?

 

// Prompt user to select files
var files = File.openDialog("Select files to import", "*.mp4", true);
if (files) {
// Import files into project bin
var project = app.project;
var bin = project.rootItem;

for (var i = 0; i < files.length; i++) {
var file = files[i];
var item = project.importFile(new ImportOptions(file));
bin.addProjectItem(item);
}

// Create a new sequence
var sequence = project.sequences.add("New Sequence", SequenceSettings());

// Add all items from the bin to the timeline
for (var j = 0; j < bin.children.numItems; j++) {
var binItem = bin.children[j];
sequence.videoTracks[0].insertClip(binItem);
}

// Run scene edit detection
var sceneDetection = app.project.activeSequence.sceneDetection;
sceneDetection.runFullScan();

// Create a folder for detected scenes
var sceneFolder = bin.createBin("Detected Scenes");

// Add detected scenes to the folder
for (var k = 0; k < sceneDetection.numScenes; k++) {
var scene = sceneDetection.getScene(k);
var sceneName = "Scene " + (k + 1);
var sceneBin = sceneFolder.createBin(sceneName);
for (var m = scene.inPoint; m <= scene.outPoint; m++) {
var sceneItem = sequence.videoTracks[0].getItemAtTime(m);
if (sceneItem) {
sceneBin.addProjectItem(sceneItem.projectItem);
}
}
}

alert("Files imported, timeline created, and scenes detected!");
} else {
alert("No files selected.");
}

TOPICS
SDK

Views

159

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Mar 08, 2024 Mar 08, 2024

Copy link to clipboard

Copied

LATEST

>Can someone tell me why this won't work?

There are many reasons. Have you stepped through this code running in PPro, in the ExtendScript debugger? 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines