Copy link to clipboard
Copied
Attempting to affect the fill of a selection with automation and running into problems.
The script doesn’t throw any errors, but the Object and Fill Transparencies aren’t being affected?
The code is all the way below.
Any help is very much appreciated.
sel
.properties = { fillColor: "None",
fillTint: 100,
fillTransparencySettings:blendMode=BlendMode.NORMAL,
fillTransparencySettings:opacity=70,
};
Hi Derek,
I'm a little confused what you like to achieve.
If you apply fillColor named "None" there is nothing you can do "effectively" about the transparency of the fill.
To see an effect on fillTransparencySettings you need a fillColor other than "None".
If you want to apply a fill like "Paper" and then set the transparency of the fill do it like that:
...var selectedObject = app.selection[0];
selectedObject.properties =
{
fillColor : "Paper" ,
fillTint : 100 ,
fillTransparencySettings :
{
Copy link to clipboard
Copied
Hi Derek,
I'm a little confused what you like to achieve.
If you apply fillColor named "None" there is nothing you can do "effectively" about the transparency of the fill.
To see an effect on fillTransparencySettings you need a fillColor other than "None".
If you want to apply a fill like "Paper" and then set the transparency of the fill do it like that:
var selectedObject = app.selection[0];
selectedObject.properties =
{
fillColor : "Paper" ,
fillTint : 100 ,
fillTransparencySettings :
{
blendingSettings :
{
blendMode : BlendMode.NORMAL ,
opacity : 60 ,
knockoutGroup : false ,
isolateBlending : false
}
}
}
Regards,
Uwe
Copy link to clipboard
Copied
Ah. And if you want to correct all other transparency settings, well that would require you to set all those settings to your desire.
Maybe then it would be better first to apply objectStyle "None" and then do all the necessary settings for all properties. Best by defining an object style and then apply it.
Regards,
Uwe
Copy link to clipboard
Copied
Thanks so much. The final full script that’s now working great is below.
*I started with a script where the transparency would not take effect (forgive for the confusion), but I knew I was going to need it in another related script, thus why the initial script posted reads fillColor: None.
Beyond that, I went to the jongware Object Model reference site and I couldn’t figure out how to interpret what seemed at first to me like a property within a property, then the values.
I’m starting to get the hang of looking things up on that reference site, but there should be a place that demonstrates how the actual syntax is constructed.
Perhaps that’s what books, W3C and this forum is for.
At any rate, thanks again. I really do appreciate it. Cheers.
var sel = app.selection;
for(var n=0;n<sel.length;n++)
{
sel
.parentStory.properties = {
/*
tracking:0,
kerningMethod:"Metrics",
pointSize:6,
leading:6,
baselineShift:0,
appliedFont:"Gotham Narrow",
fontStyle:"Medium",
fillColor:"Black",
fillTint:100,
horizontalScale:100,
verticalScale:100,
skew:0,
spaceAfter:0,
spaceBefore:0,
justification:Justification.CENTER_ALIGN,
skew:0,
*/
allowArbitraryHyphenation:true,
hyphenateAcrossColumns:true,
hyphenateAfterFirst:1,
hyphenateBeforeLast:1,
hyphenateCapitalizedWords:true,
hyphenateLadderLimit:0,
hyphenateLastWord:true,
hyphenateWordsLongerThan:3,
hyphenation:true,
hyphenationZone:"0.1 in",
};
sel
.textFramePreferences.properties = { autoSizingReferencePoint: AutoSizingReferenceEnum.TOP_CENTER_POINT,
autoSizingType: AutoSizingTypeEnum.HEIGHT_AND_WIDTH,
insetSpacing: [".025 in", ".025 in", ".035 in", ".025 in"],
// ignoreWrap:true,
// useMinimumWidthForAutoSizing:true,
//minimumWidthForAutoSizing:"0 in",
// useFixedColumnWidth:true,
// textColumnFixedWidth:".3367 in",
// verticalJustification:VerticalJustification.TOP_ALIGN,
};
sel
.properties = { fillColor : "White" ,
fillTint : 100 ,
fillTransparencySettings :
{
blendingSettings :
{
blendMode : BlendMode.NORMAL ,
opacity : 80 ,
knockoutGroup : false ,
isolateBlending : false
}
}
};
};