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

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

633

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

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

 

Votes

Translate

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

 

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 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.

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

 

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 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!

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