Select file dialog for illustrator scripting
Copy link to clipboard
Copied
I can't find anything related to this in the Illustrator Scripting docs.
I would like to select a file and get a file path so I can do something with it in scripting. Is this something that should just be done with standard js or does illustrator have a Select File Dialog box you can call?
Explore related tutorials & articles
Copy link to clipboard
Copied
If you ExtendScript, You can use "Script UI" class, or you want to make CEP Extension, You can use "showOpenDialog" method under the "window.cep.fs".
However, You need to read some references before you try.
Here are some links you need to know about it.
https://www.adobe.io/apis.html
https://github.com/Adobe-CEP/CEP-Resources/blob/master/CEP_9.x/Documentation/CEP%209.0%20HTML%20Exte...
Copy link to clipboard
Copied
According to this reference:
https://www.adobe.com/devnet/creativesuite/articles/adobe-cep-apis.html
This would be the code to showOpenDialog:
var filetypes = new Array(); filetypes[0] = “pptx”; filetypes[1] = “do”; filetypes[2] = “psd”; var result = window.cep.fs.showOpenDialog(false,false,’SELECT PSD’,’/tmp/’,filetypes); alert(result.data); //displays the path to the selected file
This does not work. This however does:
var result = window.cep.fs.readFile(path); so the window.cep.fs does work but showOpenDialog doesn't. Also I've tried to find more info on showOpenDialog and no luck. Any ideas what I'm doing wrong?
Copy link to clipboard
Copied
The documentation has read file from path, make dir, writeFile but no showOpenDialog or how to select a file:
Copy link to clipboard
Copied
Ok forget all that other stuff! This worked:
var result = window.cep.fs.showOpenDialog();
alert(result.data);
Copy link to clipboard
Copied
you can use the openDialog Function
var f = File.openDialog ('Select File...');
alert(f.fullName);
Copy link to clipboard
Copied
This did not work, no error just didn't work.
Copy link to clipboard
Copied
Can i filter pdf file?
Copy link to clipboard
Copied
I was shocked to find that this actually works. Now... how do we find the path of the scripts directory?

