bad argument ImportFiles when executing CEP panel

Participant ,
Jun 07, 2021 Jun 07, 2021

Copy link to clipboard

Copied

Dear friends, I'm new to CEP panels and Javascript.

I'm trying to import image sequence from folder on click event in CEP panel.

Here is my function:

function openDocument(){
var InsertIntoTrack = 1;
var overwrite = false;

app.project.importFiles("D:\\Destination_folder\\File_000.png", true, null, false);

}

When clicking the button in my CEP panel I got error  "bad argument ImportFiles".

Could you tell me what is wrong with my function?

Yaroslav.

TOPICS
Import, SDK

Views

290

Likes

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

correct answers 1 Correct Answer

Explorer , Jun 07, 2021 Jun 07, 2021
Here is a description of importFiles() function from the docs:https://ppro-scripting.docsforadobe.dev/general/project.html?highlight=importfile#project-importfilesapp.project.importFiles(filePaths, suppressUI, targetBin, importAsNumberedStills); // importAsNumberedStills is a boolean value, if true images will be imported as sequence.If I remember right you need to import the very first file in you sequence. The file you import acts as a first file in an image sequence, e.g.:- first imported fi...

Likes

Translate

Translate
Participant ,
Jun 07, 2021 Jun 07, 2021

Copy link to clipboard

Copied

I've maneged to make it work partially by modifying the code like this:

function openDocument(){
var file = new File('mypath\\File_000.png');
var fs = file.fsName;
app.project.importFiles([file.fsName]);
}

It imports single file File_000.png. 

However, I need to import the whole image sequence. File_000.png, File_001.png and so on.

I've read this thread

https://community.adobe.com/t5/premiere-pro/importing-images-as-a-sequence-in-adobe-premiere-pro-usi...

where it is said that I should add additional parameters to  app.project.importFiles().

 

But then, which file shall I pass as a first argument?  The first in image sequence (File_000.png)?

Or, may be the destination folder?

 

 

 

 

  

Likes

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
Explorer ,
Jun 07, 2021 Jun 07, 2021

Copy link to clipboard

Copied

Here is a description of importFiles() function from the docs:

https://ppro-scripting.docsforadobe.dev/general/project.html?highlight=importfile#project-importfile...

app.project.importFiles(filePaths, suppressUI, targetBin, importAsNumberedStills);

// importAsNumberedStills is a boolean value, if true images will be imported as sequence.

If I remember right you need to import the very first file in you sequence. The file you import acts as a first file in an image sequence, e.g.:

- first imported file: file_000.png, you will get image sequence: file_000 - file_999.png

- first imported file: file_666.png, you will get image sequence: file_666 - file_999.png

Likes

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 ,
Jun 07, 2021 Jun 07, 2021

Copy link to clipboard

Copied

> But then, which file shall I pass as a first argument? 

 

None. As seen in the example usage, the first parameter must be an ARRAY of file paths.

Likes

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
Participant ,
Jun 07, 2021 Jun 07, 2021

Copy link to clipboard

Copied

LATEST

Dear Ivan,

thank you for a quick answer.

Bruce, thank you as well for an illuminating remark.

It finally worked! For future references I post a working example:

var file = new File('the_path\\File_000.png');
var fs = file.fsName;
app.project.importFiles([fs], true, app.project.getInsertionBin(),true);

Yaroslav.

Likes

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