Skip to main content
Known Participant
March 23, 2021
Answered

Premiere + javascript automation.

  • March 23, 2021
  • 1 reply
  • 1845 views

I need to make automated video creation using javascript from small videos.

The main problem is that i can't find any proper documentation...

For example this will receive error:

 

folder = new Folder('C:\Users\dangerd\Desktop\Test');
var tempFiles = folder.getFiles(function(f) { return f instanceof File; });

 

 While this works well: (folderPath variable is somehow defined)

 

new Folder('C:\Users\dangerd\Desktop\Test');
var tempFiles = folderPath.getFiles(function(f) { return f instanceof File; });

 

 okay, that's weird...

So next question, how i can import all files from specified directory and put them into timeline with simple transitions between them and export video?

This topic has been closed for replies.
Correct answer Bruce Bullis

The first snippet ("this will receive error") works fine, here.


> how i can import all files from specified directory

In the above example, you would call importFiles(), passing in an array of file paths...which you can obtain, in your example, via tempFiles[a].fsName (where 'a' is less than the number of items in the tempFiles array).

>...put them into the timeline 

Here's how to insert: https://github.com/Adobe-CEP/Samples/blob/63f176a4903b9be9e6aa73133ae689a3904f78c8/PProPanel/jsx/PPRO/Premiere.jsx#L1655

> with simple transitions

There's no method for applying transitions, within PPro's supported public DOM.

 

1 reply

Bruce Bullis
Community Manager
Bruce BullisCommunity ManagerCorrect answer
Community Manager
March 23, 2021

The first snippet ("this will receive error") works fine, here.


> how i can import all files from specified directory

In the above example, you would call importFiles(), passing in an array of file paths...which you can obtain, in your example, via tempFiles[a].fsName (where 'a' is less than the number of items in the tempFiles array).

>...put them into the timeline 

Here's how to insert: https://github.com/Adobe-CEP/Samples/blob/63f176a4903b9be9e6aa73133ae689a3904f78c8/PProPanel/jsx/PPRO/Premiere.jsx#L1655

> with simple transitions

There's no method for applying transitions, within PPro's supported public DOM.

 

Known Participant
March 23, 2021

First snippet doesn't works, it shows 0 files while second returns videos count

Bruce Bullis
Community Manager
Community Manager
March 23, 2021

I've confirmed that this snippet works correctly. 

var folder = new Folder('/Users/bbb/Desktop/testtest');

var tempFiles = folder.getFiles(function(f) { return f instanceof File; });

for (var a = 0; a < tempFiles.length; a++) {
    var pathToThisFile = tempFiles[a].fsName;
}