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

Copy+Paste or Duplicate a sequence with a script?

New Here ,
Apr 11, 2025 Apr 11, 2025

Looking to duplicate a sequence a bunch of times using a script and then label each one for a different language. I saw in a different post that the clone function was available. However, whenever I exectue, I get the exception: "sequence.clone is not a function"

For transparency, here is my script:

// List of languages to use as suffixes
var languages = [
"Chinese (Simplified)",
"Spanish Mexican",
"German",
"Czech",
"Polish",
"Slovak",
"Serbian",
"Portuguese-Brazil",
"Italian",
"Spanish",
"Hindi",
"Kannada",
"Marathi",
"Tamil",
"Arabic",
"Macedonian",
"Korean",
"Romanian",
"Swedish",
"Turkish",
"French",
"Thai",
"Hungarian",
"Japanese",
"Slovenian"
];

// Function to duplicate a sequence and rename each duplication with language suffixes
function duplicateAndRenameSequenceWithLanguages(sequenceName, languages) {
var project = app.project;
var sequence = findSequenceByName(project.rootItem, sequenceName);

if (sequence) {
for (var i = 0; i < languages.length; i++) {
var newSequenceName = sequenceName + " - " + languages[i];
var newSequence = sequence.clone();
if (newSequence) {
newSequence.name = newSequenceName;
$.writeln("Created sequence: " + newSequenceName);
} else {
$.writeln("Failed to create sequence: " + newSequenceName);
}
}
} else {
$.writeln("Sequence not found: " + sequenceName);
}
}

// Function to find a sequence by name in the project
function findSequenceByName(item, name) {
$.writeln("Checking item: " + item.name + ", Type: " + item.type);
if (item && item.name === name && item.type === 1) { // Type 1 corresponds to both clips and sequences
if (item.getMarkers) { // Sequences have markers
$.writeln("Found sequence: " + item.name + ", Type: " + item.type);
return item;
}
} else if (item && item.children) {
for (var i = 0; i < item.children.numItems; i++) {
var found = findSequenceByName(item.children[i], name);
if (found) {
return found;
}
}
}
return null;
}

// Debugging: List all items in the project
function listAllItems(item, depth) {
if (item) {
var indent = new Array(depth + 1).join(" ");
$.writeln(indent + "Item: " + item.name + ", Type: " + item.type);
if (item.children) {
for (var i = 0; i < item.children.numItems; i++) {
listAllItems(item.children[i], depth + 1);
}
}
}
}

// Main script execution
var sequenceName = "Main V1"; // Replace with the name of the sequence you want to duplicate

$.writeln("Listing all items in the project:");
listAllItems(app.project.rootItem, 0);

duplicateAndRenameSequenceWithLanguages(sequenceName, languages);

 

TOPICS
SDK
106
Translate
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

correct answers 1 Correct answer

Adobe Employee , Apr 13, 2025 Apr 13, 2025

Hi responsible_Radiance3086,

Thanks for writing, your project sounds like a good one. 

Check out the link below - sequence.close() is a function, but it returns a boolean, not a sequence.

https://ppro-scripting.docsforadobe.dev/sequence/sequence/#sequenceclone

Regards,

Dan

 

Translate

correct answers 1 Pinned Reply

Adobe Employee , Apr 11, 2025 Apr 11, 2025

Hey there!
Thanks for your post and welcome to the forum. In the future, for developer related questions, tag the post with the "SDK" tag (I just did that for you). That will alert the appropriate Adobe Experts and product team members best suited to answer such a question. I will have to ask for your patience for a solution from the product team as we are still traveling back from the NAB conference. Hopefully, an Adobe Expert will chime in, in the meantime. I hope that is OK. Sorry for the frus

...
Translate
Adobe Employee ,
Apr 11, 2025 Apr 11, 2025

Hey there!
Thanks for your post and welcome to the forum. In the future, for developer related questions, tag the post with the "SDK" tag (I just did that for you). That will alert the appropriate Adobe Experts and product team members best suited to answer such a question. I will have to ask for your patience for a solution from the product team as we are still traveling back from the NAB conference. Hopefully, an Adobe Expert will chime in, in the meantime. I hope that is OK. Sorry for the frustration.

 

Thanks,
Kevin

 

Kevin Monahan - Sr. Community & Engagement Strategist – Pro Video and Audio
Translate
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 ,
Apr 13, 2025 Apr 13, 2025
LATEST

Hi responsible_Radiance3086,

Thanks for writing, your project sounds like a good one. 

Check out the link below - sequence.close() is a function, but it returns a boolean, not a sequence.

https://ppro-scripting.docsforadobe.dev/sequence/sequence/#sequenceclone

Regards,

Dan

 

Translate
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