Highlighted

CEP Panel to reveal file in folder

Community Beginner ,
Jul 01, 2020

Copy link to clipboard

Copied

Is there a way to show an Item in a folder in a CEP Panel for Premiere Pro?

 

In electron I can:

const {shell} = require('electron');

shell.showItemInFolder(fileList[0]);

 

In adobe I think I should be able to do it through nw.js but I'm not sure how I execute the nw command:

nw.Shell.showItemInFolder(fileList[0]);

Correct answer by CIR_Reveal | Community Beginner

After some struggle, I've gotten this to work:

In this case fileList = ["X:\\Preview\\vid\\vid_original\\PRIVATE\\M4ROOT\\CLIP\\C0005.MP4"]

 

var path = fileList[0]; // This has the file path with escaped backslashes
path = path.replace(/\\\\/g, "\\");
console.log("Path", path);
var command = 'C:\\Windows\\explorer.exe';
var cmd = command + ' /select, "'+path+'"';
var process = require('child_process');
var exec = process.exec;
exec(cmd, function(err, stdout, stderr) {
});

Topics

How to, SDK

Views

96

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

CEP Panel to reveal file in folder

Community Beginner ,
Jul 01, 2020

Copy link to clipboard

Copied

Is there a way to show an Item in a folder in a CEP Panel for Premiere Pro?

 

In electron I can:

const {shell} = require('electron');

shell.showItemInFolder(fileList[0]);

 

In adobe I think I should be able to do it through nw.js but I'm not sure how I execute the nw command:

nw.Shell.showItemInFolder(fileList[0]);

Correct answer by CIR_Reveal | Community Beginner

After some struggle, I've gotten this to work:

In this case fileList = ["X:\\Preview\\vid\\vid_original\\PRIVATE\\M4ROOT\\CLIP\\C0005.MP4"]

 

var path = fileList[0]; // This has the file path with escaped backslashes
path = path.replace(/\\\\/g, "\\");
console.log("Path", path);
var command = 'C:\\Windows\\explorer.exe';
var cmd = command + ' /select, "'+path+'"';
var process = require('child_process');
var exec = process.exec;
exec(cmd, function(err, stdout, stderr) {
});

Topics

How to, SDK

Views

97

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
Adobe Employee ,
Jul 02, 2020

Copy link to clipboard

Copied

A folder in the OS, or a folder (bin) in the Project panel?

 

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
Reply
Loading...
Community Beginner ,
Jul 02, 2020

Copy link to clipboard

Copied

It is a folder in the OS...

 

I've come across your previous answers suggesting : window.cep.process.createProcess('C:\\Windows\\explorer.exe','yourAbsoluteFolderPathAsString')

 

However, this runs Windows explorer, but doesn't open to the correct folder.

Ideally, I'd like to use the "/select," option so that a particular file is highlighted, and of course use the file path in that case.

 

I have also seen that someone else is running into a similar issue here, but I don't see a good response to it - https://stackoverflow.com/questions/38448873/opening-explorer-to-a-specific-file-in-node-js

 

Thanks!

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
Reply
Loading...
Adobe Employee ,
Jul 02, 2020

Copy link to clipboard

Copied

>...However, this runs Windows explorer, but doesn't open to the correct folder.

 

Here, it opens the folder specified by the string; what does it open, on your system?

Ideally, I'd like to use the "/select," option so that a particular file is highlighted, and of course use the file path in that case.

 

I don't know of any way to accomplish that, using CEP calls. 

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
Reply
Loading...
Community Beginner ,
Jul 02, 2020

Copy link to clipboard

Copied

It opens to "This PC > Documents" -- I tried with both \\ and \ as separator

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
Reply
Loading...
Community Beginner ,
Jul 02, 2020

Copy link to clipboard

Copied

After some struggle, I've gotten this to work:

In this case fileList = ["X:\\Preview\\vid\\vid_original\\PRIVATE\\M4ROOT\\CLIP\\C0005.MP4"]

 

var path = fileList[0]; // This has the file path with escaped backslashes
path = path.replace(/\\\\/g, "\\");
console.log("Path", path);
var command = 'C:\\Windows\\explorer.exe';
var cmd = command + ' /select, "'+path+'"';
var process = require('child_process');
var exec = process.exec;
exec(cmd, function(err, stdout, stderr) {
});

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
Reply
Loading...