user432350
user432350

Reputation: 163

Photoshop CEP panel - select path to json file

I am currently constructing my first photoshop CEP panel and I am struggling with how I can get the user to open a navigation panel to set the path to the data file I want to use in the script (JSON) and the folder containing the images I want to import. Currently, I am using a defined location path in my script but to make it more useful they really need to be selectable. I can find numerous examples of how this can be don't with a standard JSX script but have been unable to find an HTML/JS example.

All help appreciated.

Upvotes: 0

Views: 586

Answers (1)

user432350
user432350

Reputation: 163

Further to Sergey Kritskiy's reply and a quick review of the CEP Documentation P63-64 I soon discovered that if you call window.cep.fs.showOpenDialog() from your CEP panel it will return a data object that contains an array of selected file paths.

$('#getData').on('click', function(){
  var obj = window.cep.fs.showOpenDialog();

  console.log(obj);
  //console.log(obj) can be viewed using chrome dev tools in the debug window
  //http://localhost:8088 - default for photoshop
  //Note: you will need to have added a .debug file to the root of your CEP panel extension
});

For full information on the return object, I would suggest using the CEP panel debug console

http://localhost:8088

Thank you Sergey!

Upvotes: 1

Related Questions