Skip to main content
Joost van der Hoeven
Community Expert
Community Expert
January 18, 2026
Answered

Sample UXP code to duplicate and rename a sequence?

  • January 18, 2026
  • 1 reply
  • 281 views

Hello,

I'm building a UXP plugin for Premiere Pro 25.6.x that needs to duplicate the active sequence and mute specific tracks. I've successfully implemented the track muting, but I cannot get the sequence duplication to work.

According to the UXP API documentation, sequence.createCloneAction() returns an Action object:
https://developer.adobe.com/premiere-pro/uxp/ppro_reference/classes/sequence/

However, there's no documentation on how to execute this Action object. I've tried multiple approaches:

  • sequence.dispatchEvent(cloneAction) → throws "Illegal Parameter type"

  • cloneAction.execute() → not a function

  • project.performAction(cloneAction) → method doesn't exist

My question: What is the correct way to execute the Action returned by createCloneAction() in the UXP API?

I've created a test script that shows all the attempts and their errors. Here's the output:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Test Clone Action</title>
  <style>
    body { 
      padding: 20px; 
      background: #2d2d2d;
      color: #ffffff;
      font-family: monospace;
    }
    button {
      padding: 10px 20px;
      font-size: 16px;
      background: #1473E6;
      color: white;
      border: none;
      cursor: pointer;
      margin-bottom: 20px;
    }
    #output {
      background: #1e1e1e;
      padding: 15px;
      border: 1px solid #555;
      white-space: pre-wrap;
      font-size: 12px;
      max-height: 600px;
      overflow-y: auto;
    }
    .error { color: #ff6b6b; }
    .success { color: #5fd368; }
    .info { color: #64b5f6; }
  </style>
</head>
<body>
  <h2>UXP Premiere Pro - createCloneAction() Test</h2>
  <button id="testBtn">Test Clone Action</button>
  <div id="output"></div>
  
  <script>
    const ppro = require("premierepro");
    const output = document.getElementById("output");
    
    function log(msg, color = null) {
      const line = document.createElement('span');
      if (color) line.className = color;
      line.textContent = msg + '\n';
      output.appendChild(line);
      console.log(msg);
    }
    
    document.getElementById("testBtn").addEventListener("click", async function() {
      output.innerHTML = '';
      log("=== Testing createCloneAction() ===", "info");
      log("");
      
      try {
        // Get active sequence
        const project = await ppro.Project.getActiveProject();
        const sequence = await project.getActiveSequence();
        
        if (!sequence) {
          log("ERROR: No active sequence", "error");
          return;
        }
        
        log(`Active sequence: ${sequence.name}`);
        
        // Count sequences before
        const seqsBefore = await project.getSequences();
        log(`Sequences before: ${seqsBefore.length}`);
        log("");
        
        // Create clone action
        log("=== Creating Clone Action ===", "info");
        log("Calling sequence.createCloneAction()...");
        
        let cloneAction;
        try {
          cloneAction = sequence.createCloneAction();
          log("✓ createCloneAction() succeeded", "success");
        } catch (e) {
          log(`✗ createCloneAction() failed: ${e.message}`, "error");
          log(`   Stack: ${e.stack}`, "error");
          return;
        }
        
        log("");
        log("=== Analyzing Clone Action Object ===", "info");
        log(`Returned value: ${cloneAction}`);
        log(`Type: ${typeof cloneAction}`);
        log(`Constructor name: ${cloneAction?.constructor?.name || 'undefined'}`);
        log(`Is null: ${cloneAction === null}`);
        log(`Is undefined: ${cloneAction === undefined}`);
        log("");
        
        // Deep inspection
        if (cloneAction) {
          log("Own properties:");
          for (let prop in cloneAction) {
            try {
              const value = cloneAction[prop];
              const type = typeof value;
              log(`  ${prop}: ${type} = ${value}`);
            } catch (e) {
              log(`  ${prop}: (error reading)`, "error");
            }
          }
          log("");
          
          log("Prototype methods:");
          try {
            const proto = Object.getPrototypeOf(cloneAction);
            const methods = Object.getOwnPropertyNames(proto);
            log(`  ${methods.join(", ")}`);
          } catch (e) {
            log(`  Error reading prototype: ${e.message}`, "error");
          }
          log("");
          
          log("Object.keys():");
          try {
            const keys = Object.keys(cloneAction);
            log(`  ${keys.length > 0 ? keys.join(", ") : "(none)"}`);
          } catch (e) {
            log(`  Error: ${e.message}`, "error");
          }
          log("");
        }
        
        // Try different ways to execute the action
        log("=== Attempting Execution Methods ===", "info");
        log("");
        
        // Method 1: dispatchEvent
        try {
          log("1. Trying sequence.dispatchEvent(cloneAction)...");
          await sequence.dispatchEvent(cloneAction);
          log("   ✓ SUCCESS!", "success");
        } catch (e) {
          log(`   ✗ Error: ${e.message}`, "error");
          log(`   Error name: ${e.name}`);
          log(`   Error stack: ${e.stack}`);
        }
        log("");
        
        // Method 2: execute
        try {
          log("2. Checking if cloneAction.execute exists...");
          if (typeof cloneAction.execute === 'function') {
            log("   Found! Trying cloneAction.execute()...");
            const result = await cloneAction.execute();
            log(`   ✓ SUCCESS! Result: ${result}`, "success");
          } else {
            log(`   ✗ cloneAction.execute is not a function (type: ${typeof cloneAction.execute})`);
          }
        } catch (e) {
          log(`   ✗ Error: ${e.message}`, "error");
          log(`   Error stack: ${e.stack}`);
        }
        log("");
        
        // Method 3: call
        try {
          log("3. Checking if cloneAction.call exists...");
          if (typeof cloneAction.call === 'function') {
            log("   Found! Trying cloneAction.call()...");
            const result = await cloneAction.call();
            log(`   ✓ SUCCESS! Result: ${result}`, "success");
          } else {
            log(`   ✗ cloneAction.call is not a function`);
          }
        } catch (e) {
          log(`   ✗ Error: ${e.message}`, "error");
          log(`   Error stack: ${e.stack}`);
        }
        log("");
        
        // Method 4: bind
        try {
          log("4. Checking if cloneAction.bind exists...");
          if (typeof cloneAction.bind === 'function') {
            log("   Found! Trying cloneAction.bind(sequence)()...");
            const boundAction = cloneAction.bind(sequence);
            const result = await boundAction();
            log(`   ✓ SUCCESS! Result: ${result}`, "success");
          } else {
            log(`   ✗ cloneAction.bind is not a function`);
          }
        } catch (e) {
          log(`   ✗ Error: ${e.message}`, "error");
          log(`   Error stack: ${e.stack}`);
        }
        log("");
        
        // Method 5: project.performAction
        try {
          log("5. Checking if project.performAction exists...");
          if (typeof project.performAction === 'function') {
            log("   Found! Trying project.performAction(cloneAction)...");
            const result = await project.performAction(cloneAction);
            log(`   ✓ SUCCESS! Result: ${result}`, "success");
          } else {
            log(`   ✗ project.performAction does not exist`);
          }
        } catch (e) {
          log(`   ✗ Error: ${e.message}`, "error");
          log(`   Error stack: ${e.stack}`);
        }
        log("");
        
        // Method 6: direct invocation
        try {
          log("6. Trying direct invocation: cloneAction()...");
          if (typeof cloneAction === 'function') {
            const result = await cloneAction();
            log(`   ✓ SUCCESS! Result: ${result}`, "success");
          } else {
            log(`   ✗ cloneAction is not callable (type: ${typeof cloneAction})`);
          }
        } catch (e) {
          log(`   ✗ Error: ${e.message}`, "error");
          log(`   Error stack: ${e.stack}`);
        }
        log("");
        
        // Wait and check if sequence was cloned
        log("=== Checking Result ===", "info");
        log("Waiting 500ms...");
        await new Promise(resolve => setTimeout(resolve, 500));
        
        const seqsAfter = await project.getSequences();
        log(`Sequences after: ${seqsAfter.length}`);
        log("");
        
        if (seqsAfter.length > seqsBefore.length) {
          log("✓✓✓ SUCCESS: Sequence was cloned! ✓✓✓", "success");
          log(`New sequence: ${seqsAfter[seqsAfter.length - 1].name}`, "success");
        } else {
          log("✗✗✗ FAILED: No new sequence was created ✗✗✗", "error");
        }
        
      } catch (error) {
        log("");
        log(`FATAL ERROR: ${error.message}`, "error");
        log(`Stack: ${error.stack}`, "error");
        console.error(error);
      }
    });
    
    log("Ready. Click button to test.");
    log("");
    log("Environment:");
    log(`  Premiere Pro: 25.6.x`);
    log(`  API: UXP`);
    log(`  Platform: macOS`);
  </script>
</body>
</html>

Environment:

  • Premiere Pro 25.6.4

  • macOS


Thanks!

Joost

Correct answer Bruce Bullis

Here's a relevant thread, that should give you what you need:

https://forums.creativeclouddeveloper.com/t/how-to-use-action-in-premierepro-uxp/8867

1 reply

Joost van der Hoeven
Community Expert
Community Expert
January 20, 2026

@Bruce Bullis can you point me in the right direction?

 

Bruce Bullis
Bruce BullisCorrect answer
Legend
January 20, 2026

Here's a relevant thread, that should give you what you need:

https://forums.creativeclouddeveloper.com/t/how-to-use-action-in-premierepro-uxp/8867

Joost van der Hoeven
Community Expert
Community Expert
January 23, 2026

Thanks @Bruce Bullis . That helped!