Using photoshopFileOptions ?!?

Explorer ,
Jul 28, 2022 Jul 28, 2022

Copy link to clipboard

Copied

I have a PSD file, containing layers, that I want to open in Illustrator.

 

To open PSD files, the Illustrator Scripting Guide suggests using the following construct
--------------------------------------------------------------------------------------------
// Opens a Photoshop file containing layers with
// preferences set to preserve layers

var psdOptions = preferences.photoshopFileOptions;
psdOptions.preserveLayers = true;
psdOptions.pixelAspectRatioCorrection = false;

// open a file using these prefs
var fileRef = File(psdFilePath);
if (fileRef != null) {
var docRef = open(fileRef, DocumentColorSpace.RGB);
}
------------------------------------------------------------------------------------------------------

and the Application.open() method is described as follows app.open(file[, documentColorSpace][, options])


i am trying to open psd files, not using a variable "fileRef".
--------------------------------------------------------------------------------------------------------
var fileRef = File(psdFilePath);
if (fileRef != null) {
var docRef = open(fileRef, DocumentColorSpace.RGB);
}
----------------------------------------------------------------------------------------------


In both cases, using or not using  "var psdOptions", when opening a PSD file, the application shows a window "Photoshop Import Option".

Moreover, when using the notation
--------------------------------------------------------------------
var docRef = app.open(fileRef, DocumentColorSpace.RGB, psdOptions);
--------------------------------------------------------------------
Where I explicitly specify the options for opening a document, I get the following response:

 

Exception has occurred: 9007
unknown open options found.

 

Is this a bug, or am I not understanding something?

TOPICS
Scripting

Views

66

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advisor , Jul 28, 2022 Jul 28, 2022

Use the first way.  Add this before the open() function:

 

app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

 

 

Likes

Translate

Translate
Advisor ,
Jul 28, 2022 Jul 28, 2022

Copy link to clipboard

Copied

Use the first way.  Add this before the open() function:

 

app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 28, 2022 Jul 28, 2022

Copy link to clipboard

Copied

Yes, this method works... But it also works without var psdOptions declaration...

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 28, 2022 Jul 28, 2022

Copy link to clipboard

Copied

LATEST

yea, if you're gonna disable the part of the script that tells you when something's wrong, you've gotta do your own checks to make sure everything goes right. Otherwise it's gonna go wrong and you're not gonna know till later.

 

Just add some validation logic before the app.open() call to ensure that all the arguments you're passing in are valid.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines