here's what I got so far :
var Text = docRef.textFrames.getByName('someText').textRange; Text.fillColor = docRef.swatches.getByName('aColor').color; Text.strokeColor = docRef.swatches.getByName('anotherColor').color;
and it works if I don't use the appearance pannel but doesn't if I use it to modify the appearance.
Thing is that my fill color need to be over the outline. I can solve that by creating two text overlaying but I was wondering if it was something that can be done without that.
as always, thanks for your time and help.
is this what you need? this script will add an extra Sroke and Fill to the text Frame and color those, not the characters.
var docRef = app.activeDocument; docRef.selection = null; var Text = docRef.textFrames.getByName('someText'); Text.selected = true; app.executeMenuCommand("Adobe New Fill Shortcut"); docRef.defaultFillColor = docRef.swatches.getByName('aColor').color; app.executeMenuCommand("Adobe New Stroke Shortcut"); docRef.defaultStrokeColor = docRef.swatches.getByName('anotherColor').color;
The script I made already add a stroke to the text if there's none (but in my situation I just need to change its color). Thing is that I am using the appearance panel to put the stroke under the fill. But when I do that the script change an object that appear under the text for some reason.
For now I simply make a text that is the outline and one over it that is the fill. Not ideal but I guess thats what appearance does in the background anyway?
Image for reference only (aspect = appearance, fond = fill, contour = outline)
You can also apply appearance attributes by applying a graphic style:
var Text = app.activeDocument.textFrames["someText"]; app.activeDocument.graphicStyles["graphicStyleName"].applyTo(Text);
But can I change the order of the outline and fill to make the fill appear over the outline?
I am unsure what you are trying to achieve, but you can manually create a graphic style where the fill is above the stroke, save it and apply it through a script.
The plan was to access the information I can edit manually from the appearance panel which I cannot do with the script I made. If I avoid the appearance panel I can achieve a similar effect by simply duplicating the object and using the top one for the fill and lower object for the outline.
here's a sample of what I want to achieve (middle result) with script to automate that process.
My solution is the third one but I wanted to know if there's a way to get to change colors in the appearance panel as if I use the appearance the script won't change the colors but change a version that... doesn't exist until I delete the appearance in the panel.