Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Script to Apply Blending Mode to New Layer

Community Beginner ,
Nov 19, 2021 Nov 19, 2021

Copy link to clipboard

Copied

I'm looking to make a basic script that creates a new layer and sets the blending mode of that layer to "Darken." I've tried using Applescript and get an error stating "Can’t make some data into the expected type." I believe this is because it's expecting to apply the blend mode to an object instead of the layer itself. Is this possible either in Applescript or Javascript? Below is the code I attempted using Applescript

tell application "Adobe Illustrator"
	set layerRef to make layer at document 1 with properties {name:"Spot White", blend mode:"darken"}
end tell

 

TOPICS
Scripting

Views

74

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

Contributor , Nov 21, 2021 Nov 21, 2021
According to Illustrator’s AppleScript dictionary, the `blend mode` property requires an enumeration (symbol) value, not a string. Use:{name:"Spot White", blend mode:darken}

Likes

Translate

Translate
Advocate ,
Nov 19, 2021 Nov 19, 2021

Copy link to clipboard

Copied

In Javascript (replace "Layer 1" with the name of your layer in quotations): 

 

app.activeDocument.layers["Layer 1"].blendingMode = BlendModes.DARKEN;

 

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
Community Beginner ,
Nov 22, 2021 Nov 22, 2021

Copy link to clipboard

Copied

LATEST

Thanks! I'll give that a try if I make a javascript version to use on my Windows PC.

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 ,
Nov 21, 2021 Nov 21, 2021

Copy link to clipboard

Copied

According to Illustrator’s AppleScript dictionary, the `blend mode` property requires an enumeration (symbol) value, not a string. Use:

{name:"Spot White", blend mode:darken}

 

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
Community Beginner ,
Nov 22, 2021 Nov 22, 2021

Copy link to clipboard

Copied

Ah-hah, that explains it! Worked like a charm after removing the quotes. Thanks!

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