Skip to main content
New Participant
March 29, 2025
Answered

Help with the new UXP createInsertProjectItemAction() method. "Script Action failed to execute"

  • March 29, 2025
  • 1 reply
  • 971 views

Hi. I've been trying to use the new UXP createInsertProjectItemAction() method to insert a clip into my main sequence's timeline, but I can't seem to get it to work. I'm getting the following error ("Script Action failed to execute."):

 

Here's the Adobe documentation page for that method.

 

Here's a sample with all of the required parameters:

SequenceEditor.createInsertProjectItemAction(projectItem, TickTime, videoTrackIndex, audioTrackIndex, limitShift);

 

Below is the entirety of my code. The error happens at line 19, and execution of the script stops before it even gets to the executeAction() function (line 29), so I don't think that's the problem. For context, my Premiere project just consists of a sequence called "Main Sequence" and a video clip called "Iceberg.MOV".

 

1  const ppro = require("premierepro");
2 
3  async function insertItem() {
4    try {
5         const project = await ppro.Project.getActiveProject();
6         const rootItem = await project.getRootItem();
7         const items = await rootItem.getItems();
8         const mainSequence = await project.getActiveSequence();
9         const editor = await ppro.SequenceEditor.getEditor(mainSequence);
10        const insertionTime = await ppro.TickTime.createWithSeconds(2);
11        var itemToInsert;
12        
13        // Specify the item you want to insert into the timeline
14        items.forEach(element => {
15            if (element.name == "Iceberg.MOV") itemToInsert = element;
16        });
17
18        // Create the insertion Action
19        actInsertProjItem = await editor.createInsertProjectItemAction(itemToInsert, insertionTime, 1, 1, false);
20        
21        // Execute the insertion Action
22        executeAction(project, actInsertProjItem);
23
24    } catch (err) {
25        console.error(err);
26    }
27  }
28
29  function executeAction(project, theAction) {
30     try {
31        project.lockedAccess(() => {
32            project.executeTransaction ((compoundAction) => {
33                compoundAction.addAction(theAction);
34            })
35        });
36    } catch (err) {
37        console.error(err);
38    }
39  }
40
41  document.querySelector("#btnPopulate").addEventListener("click", insertItem);

 

Things I've already investigated:

  • Checked to make sure I'm running the latest version of the Premiere Pro beta app (25.3.0 build 33).
  • My seqEditor variable is of the right type (SequenceEditor object).
  • All of the parameters passed in the createInsertProjectItemAction() method are of the right type (projectItem, TickTime, numbers, booleans).
  • Tried changing the values of the videoTrackIndex, audioTrackIndex parameters to different numbers.
  • Tried changing the value of the limitShift parameter (true/false, 0/1 etc).
  • Tried different types of items to insert (video clip, sequence, adjustment layer, color matte etc).
  • I've also tried searching online for help, but Google literally returns zero pages discussing this method except for the Adobe documentation page and a Creative Cloud Developer forum page announcing its release 10 days ago (March 19, 2025).

 

If you have any ideas on how I can get it to work, or if you can spot any errors in my code please let me know. Thanks!

Correct answer Ben Insler

Hi @dmedel 

Thank you so much for this. I was having the same issue as well.
lockedAccess and executeTransaction did the trick for me as well.
I was trying to use the createAddMarkerAction action and was following the documentation correctly in terms of setting up the function itself.
I tried to download the sample panel (which looks like a great resource btw) per the gitHub link you posted but not able to run the build.

Should I create an issue in the GitHub repository? I've just started with an automation project and the markers was just the first step. So having the ability to view this sample template would be great.

Thanks again for sharing your findings.

All the best with your project!

 


Hi @pdatar ,

 

From your Terminal screenshot, it looks like you're running npm run build, but have not follwed it with the npm run fix-imports command.  npm run fix-imports needs to be run to correct some errors that result from the current build process (as detailed in the Build Test Panel instructions).  Give that a try and see if it resolves your issue.

 

Also, just a note: I see you've tried to use the TypeScript compiler in your Terminal screenshot.  You are, of course, more than welcome to use the TypeScript compliler for your own UXP Plugins.  However, for the provided 3psample-panel, npm is used and the TypeScript complier is not needed. 

1 reply

Bruce Bullis
Community Manager
Community Manager
March 31, 2025

createInsertProjectItemAction() works great in the sample plugin, so we're hopeful you can get this to work...

 

What happens in your case, if you pass ppro.TickTime.TIME_ZERO as the insertion time? 

dmedelAuthor
New Participant
March 31, 2025

Hi @Bruce Bullis 

 

Thanks for your quick reply! I tried using ppro.TickTime.TIME_ZERO as the insertion time,  but I got the same error (Script action failed to execute.)

 

Can you point me to where I can find the sample plugin you mentioned? I'd love to take a look at that code and compare it to mine.

 

Thanks!

dmedelAuthor
New Participant
March 31, 2025

Nevermind, I found it.

 

In case anyone else is wondering, it can be found at this github repository.

 

I'll report back whether or not I'm able to get it working.

 

Thank you