• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Using photoshopFileOptions ?!?

Engaged ,
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

262

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

Guide , Jul 28, 2022 Jul 28, 2022

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

 

app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

 

 

Votes

Translate

Translate
Adobe
Guide ,
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;

 

 

Votes

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
Engaged ,
Jul 28, 2022 Jul 28, 2022

Copy link to clipboard

Copied

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

Votes

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
Community Expert ,
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.

Votes

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