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
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}
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;
Copy link to clipboard
Copied
Thanks! I'll give that a try if I make a javascript version to use on my Windows PC.
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}
Copy link to clipboard
Copied
Ah-hah, that explains it! Worked like a charm after removing the quotes. Thanks!