Scripting syntax

Contributor ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

I'm having a lot of issues with the Javascript CS4 Scripting Reference for Illustrator. Not only is it full of typos, it is also not clear at times. For a case sensitive language, this is a headache.

For example, on page 45 for EPSSaveOptions properties:

-Is the correct syntax for a property like "overprint":

var saveOpts = new EPSSaveOptions();

saveOpts.overprint = PDFOverprint.PRESERVEPDFOVERPRINT;

or simply

saveOpts.PDFOverprint.PRESERVEPDFOVERPRINT;

 

-Also, in the Save As Illustrator EPS menu, there are various options under Transparency>Preset (and a window pops up with further parameters that can be set such as Raster/Vector Balance. Can those also be set via script?

 

Thanks.

TOPICS
Scripting

Views

1.6K

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 ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

Hi 

Correct syntax is

 

var saveOpts = new EPSSaveOptions();
saveOpts.overprint = PDFOverprint.PRESERVEPDFOVERPRINT;

 

 

See, example from page 46 to set options

Screenshot 2021-05-05 at 11.22.05 AM.png

Best regards

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
Contributor ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

That was a typo on my end! Let me correct that in the initial post.

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 ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

ohh, I thought may be you did not realize. 🙂

I have removed that line from the prvious post.

Best regards

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
Contributor ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

If I write:

saveOpts.PDFOverprint.PRESERVEPDFOVERPRINT;

I don't see any error when running it.

 

Any insight on the menu items and their access via script?

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 ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

I am not using CS4 but I tried this version in latest version of Illustartor and it gives me an error. Please see screenshot

Screenshot 2021-05-05 at 11.42.43 AM.png

 

May be you need to restart your editor and illustrator

 

Which menu items you want to access?

Here is the list of commands that you can use for the menu items via script

https://ten-artai.com/illustrator-ccver-22-menu-commands-list/

 

Syntax :

 

app.executeMenuCommand('COMMAND_NAME')

 

 

Example:

app.executeMenuCommand("Find Stroke Color menu item");

 

The above command is equivalent to menu Select -> Same -> Stroke Color

 

I hope this helps you.

Best regards

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
Contributor ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

I was referring to the Save As Illustrator EPS menu items that show in a separate popup window under Transparency>Preset when you click on Custom. One of the items is, for example, Raster/Vector Balance. I don't see an entry for that in the ESPSaveOptions properties.

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 ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

Yes these are not available in the documentations and as per my knowledge I don't think so there is direct menu command for these.

Did you try by recording an action and then executing it?

Best regards

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
Contributor ,
May 04, 2021 May 04, 2021

Copy link to clipboard

Copied

Hi Charu. No, I intended to do it entirely via a script. If I do that via script, then what would be the default values used for those items that can only be changed in the AI menu for Transparency? The popup window's name is "Custom Transparency Flattener Options" and it pops up from the "EPS Options" window.

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
Contributor ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Any suggestion?

The Low Resolution and Medium Resolution presets in "Custom Transparency Flattener Options" check the boxes for Convert All Strokes to Outlines and/or Clip Complex Regions. The High Resolution preset doesn't. Is there a way to have control over these paramaters in script?

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 ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Hi,

I don't have CS4 and truly speaking I have never worked in CS4 version, I have these option as a a drop down and they are disable for me. See screenshot.

 

Screenshot 2021-05-05 at 6.16.19 PM.png

May be someone else can help you in this when they will see the post.

Best regards

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
Contributor ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Hi Charu. Your screenshot shows you the items I am referring to! Under Transparency, you can see the Preset Medium Resolution. It is greyed out because you probably don't have any transparency in your document. If you put something with transparency (like an object with an opacity other than 100%), that option will be enabled and if you click on it, you should see the popup window I referred to "Custom Transparency Flattener Options".

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 ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

I could not find anything that we can do with script .

May be someone else has some way to do it.

Best regards

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
Contributor ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Okay. Thanks for trying to help Charu.

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 ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Since the EPS format doesn't support Transparency it is moot.

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
Contributor ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

It's not moot at all. Those parameters are for flattening transparency!

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 ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

I don't think we have access to the Transparency Preset Settings via scripting, however you could potentially modify the presets file manually to change the values of the default preset.

 

In my computer the default preset is [Medium Resolution], try changing the values of the medium preset to whatever you need

/collection2 {
	/attributes {
		/collectionName [ 19
			5b4d656469756d205265736f6c7574696f6e5d
		]
		/AI10\ flattener\ outline\ text 0
		/AI10\ flattener\ outline\ strokes 1
		/AI10\ flattener\ clip\ complex\ regions 1
		/AI16\ flattener\ anti\ alias 0
		/AI10\ flattener\ raster-vector\ balance 75
		/AI9\ Output\ Rasterization\ Resolution 300.0
		/AI9\ Mesh\ Rasterization\ Resolution 150.0
	}
	/canEdit 0
	/canDelete 0
}

 

the file is located here

"C:\Users\canto\AppData\Roaming\Adobe\Adobe Illustrator 25 Settings\en_US\x64\Transparency Flattener Presets"

 

you might need to close illustrator before making any changes and make a back up copy of the original file

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
Contributor ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

Hi Carlos,

Great information. Thanks. I was not aware of that. I looked at this file and have a few questions.

-Is there a way to see or set the default Transparency Flattener preset other than looking at what shows in the menu (in my case, it also appears to be Medium Resolution)?

-Rather than modify one of the presets in the file you mention (there are three in my case, called Collection1, Collection2, etc), is it possible to create a fourth collection where I define my own paramaters and set that as the default?

That being said, the collection name (High Resolution, Medium Resolution, Low Resolution) appears in a coded fashion in this file, as seen in the excerpt you showed. So how could I set a name for this new collection and the name would appear in the roll-down menu in the Transparency Preset window?

-Would restoring a backup file of this file reinstate everything correctly to its default state for sure?

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 ,
May 05, 2021 May 05, 2021

Copy link to clipboard

Copied

LATEST

1. I did not find a way to set a different default preset.

2. You can create your own Preset. Go to Edit->Transparency Flattener Presets...but then see #1

3. See #2

4. I think it will, try it and let us know.

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