Skip to main content
Participant
June 23, 2018
Answered

Illustrator Script - Open TIFF or PSD without options dialog

  • June 23, 2018
  • 1 reply
  • 976 views

I'm writing a script that opens a series of TIFF files in Illustrator and re-saves them as EPS files after performing a few operations. I specifically need to open each file and "Convert Layers to Objects" per the TIFF Import Options. While I'm currently working with TIFF files for my input, I can change that to PSD input files if necessary so if you have any info regarding that instead of TIFFs, that may help too.

App.open() works to get my files open, but it also brings up the TIFF Import Options dialog box, which hinders the script's efficiency because this will need to run with little to no human interaction outside of an initial button press to start the script.

It seems like the answer would be in calling the open() method with a second argument for my open options, but I can't find any documentation that outlines the possible open options. Can anyone point me in the direction of the proper documentation for this or tell me how to figure out the open options for opening TIFFs in Illustrator?

Note: This project requires that I specifically open a layered TIFF or PSD directly in Illustrator so unfortunately importing my files into an existing file and then embedding them won't suffice here.

This topic has been closed for replies.
Correct answer ValiasIvilian

I believe I actually found what I need in the userInteractionLevel property of app. It's a little curious to me just how different some of the properties in Illustrator are from Photoshop, but this seems to be the functional equivalent of Photoshop's displayDialogs property and what I had been looking for.

var filesToOpen = new Folder('D:\\Test\\WIP\\000000000\\').getFiles('*.tif')

app.preferences.photoshopFileOptions.preserveLayers = true;

app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

for(var x = 0; x < filesToOpen.length; x++){

    app.open(filesToOpen, DocumentColorSpace.CMYK, OpenOptions.OpenOptionsPhotoshop);

}

1 reply

Silly-V
Legend
June 24, 2018

Check out the OpenOptionsPhotoshop object.

Inside the ESTK's OMV (Object Model Viewer) it shows the following:

Participant
June 25, 2018

Thanks for the reply Silly-V. Unfortunately, simply adding the open options doesn't seem to do any good. I still get the dialog box. Any idea what else I'm missing here, and/or can you point me to any examples?

var filesToOpen = new Folder('D:\\Test\\WIP\\000000000\\').getFiles('*.tif');

for(var x = 0; x < filesToOpen.length; x++){

    app.open(filesToOpen, DocumentColorSpace.CMYK, OpenOptions.OpenOptionsPhotoshop);

}

ValiasIvilianAuthorCorrect answer
Participant
June 25, 2018

I believe I actually found what I need in the userInteractionLevel property of app. It's a little curious to me just how different some of the properties in Illustrator are from Photoshop, but this seems to be the functional equivalent of Photoshop's displayDialogs property and what I had been looking for.

var filesToOpen = new Folder('D:\\Test\\WIP\\000000000\\').getFiles('*.tif')

app.preferences.photoshopFileOptions.preserveLayers = true;

app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

for(var x = 0; x < filesToOpen.length; x++){

    app.open(filesToOpen, DocumentColorSpace.CMYK, OpenOptions.OpenOptionsPhotoshop);

}