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.
Here is a description of importFiles() function from the docs:
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 fi
...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
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?
Copy link to clipboard
Copied
Here is a description of importFiles() function from the docs:
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
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.
Copy link to clipboard
Copied
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.