Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How can I open a local folder view by clicking on a link

Participant ,
May 23, 2017 May 23, 2017

Hello All,

Is there any way to open a local folder (file explorer not a file chooser) from a link in a premiere pro panel? Is this possible using cep API?

Premiere Pro version: 11.1.0

Extension Type: Panel


Thanks & Regards,
Meet Tank

TOPICS
SDK
2.4K
Translate
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

Engaged , May 23, 2017 May 23, 2017

Yes. (If I was trying to be cheeky I'd stop right here.)

I do it like so:

Win:

window.cep.process.createProcess('C:\\Windows\\explorer.exe','yourAbsoluteFolderPathAsString')

Mac:

window.cep.process.createProcess('/usr/bin/open','yourAbsoluteFolderPathAsString')

Translate
Engaged ,
May 23, 2017 May 23, 2017

Yes. (If I was trying to be cheeky I'd stop right here.)

I do it like so:

Win:

window.cep.process.createProcess('C:\\Windows\\explorer.exe','yourAbsoluteFolderPathAsString')

Mac:

window.cep.process.createProcess('/usr/bin/open','yourAbsoluteFolderPathAsString')

Translate
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 ,
May 25, 2017 May 25, 2017

Thanks e.d.​ I am trying to replace the windows folder path by the environment variable as below:

window.cep.process.createProcess('%WINDIR%\\explorer.exe','yourAbsoluteFolderPathAsString')

But that didn't work. Could you please help me to achieve this?

Thanks,
Meet

Translate
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
Engaged ,
May 25, 2017 May 25, 2017

Hey Meet,

for some reason unknown to me (and so far not explained by the CEF/CEP guys), you have to provide absolute paths. System environment variables will not work direclty AFAIK, they do not seem to get expanded.

In ExtendScript you would use $.getenv("WINDIR") , but how that would be solved in JS+CEP, I don't know (yet).

Translate
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 ,
May 25, 2017 May 25, 2017

Thank you e.d.​ It is very useful.

Thanks,
Meet

Translate
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
Enthusiast ,
May 25, 2017 May 25, 2017

meett9325076​, if you're willing to enable the NodeJS context in your panel, you could do the following:

var process = require('process');

var path = require('path');

var basePath = process.env.WINDIR;

if (basePath !== undefined)

{

    var path = basePath + path.sep + "explorer.exe";

    window.cep.process.createProcess(path, 'yourAbsoluteFolderPathAsString');

}

else

{

    // Handle with fallback or error.

}

See the NodeJS documentation for process.env for more.

How you handle the paths and error conditions is, of course, up to you!

Translate
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 ,
Jan 15, 2020 Jan 15, 2020
LATEST

Hi, should this method still work? I'm trying this on a mac with this line:

 

window.cep.process.createProcess('/usr/bin/open','Volumes/.../90834_Render_Log.txt');

 

I took away part of the path for securty reasons. When I try to run this within my CEP panel it gives me the error 'window is not defined'. Do I need to do something to define 'window'?

 

EDIT: I figured it out. I had put the code in the premiere.jsx but it needs to be in the index.html. It works now.

Translate
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