Making a html5 panel in photoshop that uses file name lists from some directory in my PC.
Here is a javascript code(made a simplified one to get the point across) that works fine if File>Scripts>Browse in photoshop but doesn't work within an extension:
var targetDirectory = ** some location **;
getNamesOfFileFromDirectory(targetDirectory);
function getNamesOfFileFromDirectory(targetDirectory){
try {
var directory = Folder(targetDirectory);
var fileList = directory.getFiles();
alert(fileList[0]);
} catch(err){
alert(err);
}
}
after some tests I find:
var directory = Folder(targetDirectory);
is causing the problem. because Folder is undefined if used inside an extension but as this works fine if loaded as a script, I think I am just missing some library that photoshop had by default.
Can you guys help me out and point me to the right direction on how to solve this problem? like is there some library I can download or alternative ways I can go to.
My main goal is to get a list of files from a specific directory through an extension in photoshop.
Photoshop supports multiple environment for extensions building. If you happen to be using Adobe's CEP within Photoshop, you can use following API:
You could find an example at https://github.com/Adobe-CEP/CEP-Resources/blob/master/CEP_7.x/Samples/CEP_HTML_Test_Extension-7.0/html/NativeFunction.html#L266