Copy link to clipboard
Copied
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
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')
Copy link to clipboard
Copied
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')
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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).
Copy link to clipboard
Copied
Thank you e.d.​ It is very useful.
Thanks,
Meet
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now