I'm trying to write a script to open PSD files in Adobe Illustrator and do some batch processing. The problem is I can't provide the needed open options.
From docs:
Application
open(File file, DocumentColorSpace documentColorSpace, Anything options)
Opens the specified document file.
...
OpenOptionsPhotoshop
Options for opening a Photoshop document, used with the open method.
So, I'm assuming I can use OpenOptionsPhotoshop
with open
method, but how?
I tried doing this:
var psdFile = new File('file.psd');
var options = new OpenOptionsPhotoshop();
options.preserveHiddenLayers = true;
app.open(psdFile, DocumentColorSpace.RGB, options);
But it says:
OpenOptionsPhotoshop does not have a constructor.
Any ideas how to pass the options to the open
method?
You shouldn't be creating an OpenOptionsPhotoshop
object, you need to access it somehow. You can access it like this:
app.preferences.photoshopFileOptions.preserveHiddenLayers = true;
I found this by looking here:
https://yearbook.github.io/esdocs/#/Illustrator/Preferences/photoshopFileOptions https://yearbook.github.io/esdocs/#/Illustrator/Application/preferences
Quick edit, the documentation for the open
method is here too. The second and third params are optional.
https://yearbook.github.io/esdocs/#/Illustrator/Application/open