Illustrator Scripting :: How To Fill Gradient Color In Textframe
Sep 3, 2013
I am working with scripting in Ai, fill gradient color in TextFrame. I search in this forum but the other topics fill color to path or line. For now, I can make a gradient color, but I don't know how to apply it to textframe.
Suppose I have an object filled with a linear gradient. This object is the only selected. I just would like to change the angle of the gradient to 25 degrees. So I think I could do:
var doc = app.activeDocument alert(doc.selection[0].fillColor.angle) // the result is the exact angle of the gradient fill of the selected object. Suppose 12 degrees.
//now the try to change: doc.selection[0].fillColor.angle = 25.0
No errors are found by the Extended Script Toolkit..BUT...it does not change anything. As Illustrator reference manual does not say this property is read only, I think I could write.
I'm trying to read a text file into a textFrame. It reads in but is not including linefeeds so it's just one big long line of text. I'm using the following code to read the file. I attempted to insert a character after each readln() but that didn't work. I also tried creating a variable that the readln() was stuffed into before setting the textFrame.contents to the variable, but that didn't work either. I'm stumped.
while (! notesDoc.eof) { noteTextRef.contents += notesDoc.readln();}
* this script will prompt the user for a file name and location and then save the current file as a .pdf with secure save options*/ var curDoc = app.activeDocument; var destName = prompt ("Enter a Filename Daniel", "", "Save With Security"); var destFolder = Folder.selectDialog('Select which folder to save to :'); saveFileToPDF(destFolder+ '/' + destName); // not sure if i need this here ?
[Code] .......
i can do the math of (artboard width)-(text width) / 2 is start point of text but how do i find out the text width and the artboard width?
I think I might be doing this wrong, I am trying to get contents of a specific textFrame within first group on layer called "page numbers"
It seems to work, but is a bit sketchy, the documentation indicates textFrame is all the text frames in a document, and that textFrameItem should be the specific one within collections of groups etc, maybe I am misunderstanding. this is what I am using:
var existingPageNumbers = app.activeDocument.layers.getByName('page numbers').groupItems[0].textFrames[0].contents;
I'm trying to find the smallest textframe within a group and then matching that textframe font size to the minimum size allowed for printing. Everything else works, except I can't figure out how to resize the textframe while also resizing its parent, the group.
I have button drawing for web in Adobe Illustrator format. I'm trying to get fill settings to create the same look with CSS. I can't find what color to use and gradient settings.
I have a script that will select text Frames, but I have come into a situation where I need to exclude any text frames that do not have a fill color. I do not see a filled Boolean property for character attributes or text Frames.
This is what I used to select all text on all visible and unlocked layers. I dont see a way to exclude textframes that have no fillcolor.
if (app.documents.length > 0 ) { var doc = app.activeDocument; var numTextFrames = 0; for ( i = 0; i < doc.textFrames.length; i++ ) { try { textArtRange = doc.textFrames[i]; textArtRange.selected = true; } catch (e) {} } }
I create gradients all the time and i'm wondering if there's a quick way to create a gradient based on the current selected object's fill color. For example: I have selected a box with a fill color of BLUE. I go to the gradient panel and see that what the gradient will be if I click on it (that is usally based on a default gradient WHITE to BLACK, or it comes from the most recent gradiented object I touched). So I click on it and the gradient is activated with the stops being not BLUE. What i want is... if i select a box with a BLUE fill and click on gradient - it will create a gradient with both stops being the same BLUE as the fill color. This would be very convenient because instead of clicking on each stop, shift-eyedropping the the blue color from a duplicated box, it would instantly start with the blue-blue gradient for me to tweak (in the case below for a button i would make the higher stop lighter and lower stop darker).
It's somewhat useful to select an object with a gradient to "copy" that gradient, select a new object, click on the gradient panel and have this new object take on that exact gradient. But most of the time i'm not copying gradients but i'm creating new ones, and it makes more sense for me to create a gradient derived from the fill color.
I'm trying to create a script in CS5 mac os10.6.8 that will change the fill color of selected pathItems. I need a simple script that will change a selected pathItem to cmyk values 2,3,15,0. I will then select this script and implement the action in a batch of 600 files.
I wish this process could be recorded as an action but when I record the action "add new swatch" I have to manually input the cmyk values, which will take forever for a batch of over 600 files.
I'm trying to figure out a way to automate a simple, yet repetative process I do countless times a day. Ideally, I'd like to tie it to a keystroke to speed up my workflow.
I work on line art and colorways for footwear, so the way I'm coloring these shapes and strokes break apart the different materials and pieces of the shoe.
While coloring line art, I work with Pantone spot colors as fills for closed path objects. I then have to manually apply that same color to the stroke, set the stroke to 0.5px weight, convert that spot stroke color to CMYK, and add 15% to the K value.
I found some code in an older post for applying the actively selected object's fill color to the stroke, but I'm having but I'm having trouble with the next step of figuring out how to take that spot stroke color and convert it to a CMYK build that I can then add 15% black to. Is this something that's even possible? I've spent about an hour playing with the script and have only had luck matching the fill color or turning the stroke white.
I have CS5. The bugs and broken features in AICS6, make it unusable in my workflow.
I am specifically concerned about the inability to drag global color swatches from the color panel to Gradient stops in the Gradient Panel. I use this method to update a gradient color because I find it MUCH faster than option-dragging to duplicate a stop color, then deleting the unused stop. Since I do this constantly, I find using CS6 very tedious.
I need to fill 20 circles with one common grad fill... so that the 1st circle is dark to the 20th as lightest (NOT each individual circle getting it's own gradient).
I'm trying to challenge myself here, I want to create a copy of every gradient in the active document and give it an assigned name like "Batman 1" "Batman 2" ect.
I can add new gradients and set their stop colors ect but I can't figure out how to create a perfect copy of the gradient in the swatch library.
I've been looking and the only thing I found that comes close was an older script that's only compatibale with CS. In this they're copying EVERYTHING I just wanna stick to gradients at the moment. Here's the link: [URL]
I looked to this as an example of how to do something like this but since it wont work with CS6 I cant really experiment or tinker to figure out how it works.
Just a few hours ago i asked about identifying a gradients type (linaer vs radial) and thatnks to Carlos I'm set with that, but I can't find a way to access the Aspect Ratio of a gradient in javascript.
The shape is a compound path with a black fill & no stroke. Alternatively, is there any way to convert that shape to individual horizontal & vertical wavy lines?
Can you fill individual characters each with a gradient, I get black when I try(the black type with one letter selected). When I create outlines from the type I get what I need(Crushed with radial gradient in each letter). I would like to keep this editable type.
I traced an image earlier, expanded it then wanted to change the line colour. For some reason I couldn't get this to work even though I've done it in the past. So, I used the magic wand to select the line then dragged it into my new document and changed the line colour.
Now, I want to change the fill on certain sections, however when I change the stroke it changes the colour of the line and when I change the fill it changes the color of the line.
I'd like to fill a shape with instances of a symbol. The sybmols should vary in size but never touch each other or the outer edges of my shape. Is there a script that can do this?
So here's what I wrote to try and find and delete all pathItems within a document that lack a fill and lack a stroke.
var doc = app.activeDocument; for (i=0; doc.pathItems.length>i;i++) { alert(doc.pathItems[i].name + " " + doc.pathItems[i].fillColor.name)
[Code]....
But alas, neither seems to do the trick, the first one makes sense why it wouldnt work since it says that the color is "undefined" but it isnt a string called "undefined." So I'm not sure how to go about this at all now.
I'm having problems getting what I want on Illustrator CS6. This is the shape that I'm working on: [URL]
I got two paths, one for the inner outline, one for the outer. I want this to be one object, looking just like that, where red is the fill, and black is the outline. Simple as that. [URL] - this is what i want.
So, the inner "circle" is not filled with anything, beacause my object is this "frame" outside. But since I have two seperate paths, I'm filling the outer path with colour, and I get:
[URL] the outer filling is red, the outside is transparent, which is good, but the inside is red because the inner path has no filling.
Right, so next I fill the inner path with white and it looks almost good: [URL]
But the inside is not transparent, it's an "illusion" and everything will be great on a white background, but that's not the case.
I want to convert these to paths into one object to behave exactly like I showed in the first image. Red is the fill, black is the outline. And I plan to use gradient mesh heavily on that shape, so that has to work to.
Bad quality, just doing some quick previews on Photoshop.
I am using CS6. I have created some text with a gradient fill. I have converted it to shapes before addin the Fill. I appear to get a slight black shadow arround the letters. This appears to get worse when I Export it to png with a transparent background. This black shadow is not a stoke that I have added.
I need to automatically create all the possible pattern combinations with 6 shapes and 6 colors.
I have an Excell file with assigned color combinations (values from 1 to 6) in the rows, and the shape name (A to F) in the columns. Column 7 is a string containin the color combination names (i.d. 123456, 123345 etc...) so that I can output each combination with the color/numbers in the name.
I'd like Illustrator to pick every row and assign the contained colors to each shape of the column and to export a .png with the name from column 7 content.
Just simple as that! But to me it sounds pretty hard!
Is there a script that makes it already posted somewhere? - i couldn't find any - or something simliar to start coding from?
Almost every time I add a linear gradient to an object I want to change the angle from 0 to 90 degrees.
Is there a script that I could use for this, so that I could assign a keyboard shortcut and press that instead of clicking the box & typing 90 all the time? (i.e. select an object, run a script & it would apply the standard black to white linear gradient at 90 degrees instead of 0.)