Illustrator Scripting :: Create A Duplicate Gradient Swatch
Aug 5, 2013
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.
View 24 Replies
ADVERTISEMENT
Mar 21, 2013
Using CS6 on a MacBookPro
I'm creating a swatch group in my swatches panel and I can click and drag any color in the swatches panel to my new folder. But it won't let me click and drag the custom gradients into this folder. How do I add my new gradient swatches to the swatch group folder in the swatches panel?
View 5 Replies
View Related
Oct 10, 2012
Swatches Swatches Read-only. The swatches in this document.
Deletes a swatch from the current document
Set appRef = CreateObject("Illustrator.Application")
Set documentSwatches = appRef.ActiveDocument.Swatches
Set swatchToDelete = documentSwatches(5)
swatchToDelete.delete
How am I supposed to be able to make changes to the swatches collection - it is read only...
Not supprisingly I have failed to implement this in C-sharp
View 5 Replies
View Related
Feb 11, 2014
Is there anyway in JavaScript to replace one swatch with another?
I've seen other posts where similar questions have been asked, but the solution seems to involve iterating over all the pageItems, testing and then changing the fillColor.
All I want to do is delete/replace a specific color. Say replace Yellow with Green.
Is there a way of doing this without recursing through all of the page items?
View 3 Replies
View Related
Feb 28, 2012
I'm needing to loop through each character of a text frame and check the color of each character. Is it possible to get the swatch name of each character? Or can you only get the red, green, blue values?
I've been experimenting with:
app.activeDocument.textFrames[0].characters[3].characterAttributes.fil lColor.typename;
// Returns SpotColor
But I can't figure out how to get the swatch name of the character this way?
View 2 Replies
View Related
Jul 20, 2012
I'm writing a script to create a new AI document with a restricted swatchbook. The designer is supposed to use only the swatches/inks provided by this script. So far I was able to delete all current swatches and add a CMYK or RGB spotcolor swatch.
var inkt02 = app.activeDocument.spots.add();
inkt02.name = 'inkt 2';
inkt02.colorType = ColorModel.SPOT;
var kleur02 = new CMYKColor();
kleur02.black = 10;
kleur02.cyan = 80;
kleur02.magenta = 0;
kleur02.yellow = 90;
inkt02.color = kleur02;
var newSpotColor = new SpotColor();
newSpotColor = inkt02;
newSpotColor.tint = 100;
thePallet.addSpot(newSpotColor);
Often we will be dealing with Pantone colors. No need to define these, as they are inside AI already, right? But how to call them from the library? I'm new to ExtendScript.
View 6 Replies
View Related
Aug 4, 2012
I have a list of 300+ colors that I need to make into a swatch library for Illustrator. The data looks like this:
GREEN GRASS,127,187,0
PALE YELLOW,241,235,135
LIGHT YELLOW,238,231,93
DAFFODIL,249,231,21
MOONBEAM,249,223,22
etc.
It's RGB I think. In any case, I am just starting with Illustrator and I know NOTHING about scripting. these colors into a swatch library? I am getting a migraine just thinking about putting them in one by one.
I found something here, but that didn't work for me. I get an error on processing on line 75. [URL] ....
Error 24: app.doScript is not a function, Line 75 _> app.dpScript(speakThis, 1095978087); //AppleScript.
I get as far as choosing the csv file, and then I get the error. I think this outputs as CMYK, but not sure.
View 23 Replies
View Related
Sep 27, 2012
I was always able to do this before. (should be simple...) I made a gradient and just want to save / add it to a Swatch Panel that I've already defined and saved. I used to be able to drag (I think) the gradient into the desired Swatch Panel and then 'save the swatch again' It won't let me do this today even though I just did it last night!
I'm working on a Windows 7 machine and I am using Illustrator CS5....
View 8 Replies
View Related
Aug 13, 2013
i want to get the swatch color of active document . i use 3 to 4 colors both cmyk and pantone which is in swatches now i want to get their values using script.
View 1 Replies
View Related
Jan 1, 2014
I recently created a script that reads the layer names of an Illustrator file, and uses the name to identify a swatch to use to pattern all elements on that specified layer. The script works well, and is a real time saver for our mapping staff, but it requires duplicate swatches to exist, where the only difference is their colour.
To improve the script I want to duplicate a swatch and modify its' colour before applying it to a specific layer. I think the only way this can be done is via the "placedItems" command. So the code I'm trying to write looks likke this:
for(var s=0; s<slib.length; s++){ // search swatch library
var pat=slib[s].name; // get swatch name
[Code]...
However I'm struggling to find the correct syntax to make this work.
View 2 Replies
View Related
Jan 14, 2013
I tried to add a LabColor with an Illustrator script.
function addLabColorToSwatch(L,a,b,swatchName){
var color = new LabColor();
color.l = L;
color.a = a;
color.b = b;
var swatchgroup = app.activeDocument.swatchGroups.add();
swatchgroup.name = "test swatchgroup from jsx script";
[code]....
The script crashes on the Line 'swatch.color = color;' with "Error 1202: Not implemented"..This seems to a bug. I allready filed it.
View 5 Replies
View Related
Feb 24, 2012
I've been looking for scripts online that would create a color swatch legend to list the colors used in my illustrator file. I found this (see below) and tweaked it to place properly on my particular page, but it adds everything in my swatches panel to the legend. Ideally, I'm looking for a piece of script to add that would only add used swatches to the legend, or a script that would only add spot colors to the legend.
var docRef=app.activeDocument;
var SwatchBoxSize=24;
var swatchBoxSize=parseFloat(SwatchBoxSize);
var swatchBoxTop=swatchBoxSize+314;
[Code] ......
View 2 Replies
View Related
Mar 20, 2012
I have a couple thousand AI authored EPS files with a specific swatch name (SpotBlack) that I would like to rename (black) -- is there any method to do this en masse, preferrably outside of Illy using a text editor?
View 7 Replies
View Related
Mar 21, 2012
Is there a way to read the swatch used for fill color of a page item?
I can read the fill color but I can't read if the color is a global swatch.
View 2 Replies
View Related
Dec 31, 2012
I have an AI file containing seamless pattern swatches.I'd like to get each swatch vectors (ie : access the swatch groupItem). It's doable when clicking on the swatch panel and dragging the swatch on the document, or even double clicking the swatch in the swatches panel, I'd like to do it with javascript.
how to access swatch patterns properties.
How to access the swatch properties, like when double clicking on the swatch in the swatches panel, how to "simulate" a drag & drop of the swatch to the document, I'll take it too, though I think it is not the most convenient way to do.
View 7 Replies
View Related
May 19, 2010
I have a large list of custom colors in Excel that has the color name and CMYK breakdown of each color. I'm looking for a way to import this information to create a custom Color Swatch Library. That will have the name of the color and the CMYK breakdown. So that I can easily use in Illustrator and Photoshop. Is there any way or application in doing this with out manually entering the information and creating a new library?
View 7 Replies
View Related
Oct 1, 2012
I'm trying to write a script that applies a single swatch to a single path item and repeat for every swatch that is currently contained in the swatch library. This script that I have written is only applying the last swatch in the swatch library to every path item on the page. Currently I'm more concered with getting each swatch that is currently in the swatch library to be applied at least once before worrying about applying the same patch to any extra number of patch items compared to the swatches.length.
// Apply every swatch library color to path items on a page
if ( app.documents.length > 0 && app.activeDocument.pathItems.length > 0 ) {
doc = app.activeDocument;
[Code]....
View 11 Replies
View Related
Sep 21, 2012
How to write a script which can duplicate objects and apply colours. I have a full break down of the project together with a Illustrator Action that demonstrates the functionality of the required script.
View 3 Replies
View Related
Dec 8, 2012
I have an Illustrator document with one layer (named Layer 1).In that layer are lines, rectangles and text.Is it possible (in script) to: make 3 additional layers named NL, EN and GEselect and cut all the text in Layer 1paste that text in the same place in the layers NL, EN and GE
(Step 2: select all text items and Ctrl-X)
(Step 3: select proper layer and Paste in Place in that layer)
I know this can be done with an action (I did that allready) but the reason I want to script this is because I have to combine this with another script which takes care of colorizing stuff.
View 5 Replies
View Related
Oct 23, 2013
Basically, I have an open AI document and would like to duplicate its artboard and then move it to a new position(X axis, 50pixels away from the original). Doesn't seem too hard, but I can't figure it out. This is for CS5.
var docRef = app.activeDocument;
var abSrc = docRef.artboards[0];
var abSrcX = abSrc.artboardRect[0];
[Code]...
Taking that into account if I add (1224 + 144) to abSrcX and abSrxW it creates another artboard 2" away from the previous at 17" x 11". If I want to run it again, I just to add (1224 + 144) to abSrcX and abSrxW again. Now to figure out how to do this dynamically on the fly.
View 5 Replies
View Related
Jun 11, 2012
[gradient tool] I double-clicked the colour stop , but the colour swatch doesn't come outI hv tried a couple of times in CS 5 and also CS 6.
View 1 Replies
View Related
May 9, 2013
In Illustrator CS4. I want to create a repeating pattern, using a swatch. I've done this before succesfully but not sure why this one isn't working as planned.
The small image at the bottom (just the area inside the artboard) is the spacing I want between the characters, but the pattern at the top is what I get.
View 3 Replies
View Related
Oct 13, 2009
we have a website concept in Illustrator CS3, with named swatches for all colors. I'm wondering if there is an easy or 'semi-automated' way to generate a chart of the swatches we are using, showing there hex values?
I know I could draw out a bunch of boxes, fill them with the swatch colors, and manually look up and type in the hex values for each. But this would take a LONG time, as there are a number of color variations.
View 15 Replies
View Related
Sep 26, 2013
Whenever I try to create a new CMYK color swatch it automatically opens pattern swatch name panel. Why won't it let me create a color swatch?
View 4 Replies
View Related
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.
View 6 Replies
View Related
Sep 11, 2013
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.
View 4 Replies
View Related
Jul 27, 2013
Illustrator CC
I am having a difficult time trying to create a new swatch libray of patterns from multiple png files. The way I am doing this is very slow and repetitive and seems silly for a tool as advanced as the latest CC suite including illustrator.
What it seems I must do is open all the png files in Illustrator, creating multiple workspaces, drag one png file into the swatch window, then save that window as a library, close the existing window to reveal the next png file, open the user library I just created, drag the next image into the currently active swatch window, then drag the previous swatch/s from the user library into the current active swatch window, resave and replace the user defined swatch library (now with two images in there)fromthe updated current active swatch panel/window, close the existing workspace to reveal the next image file, and then repeat the process again, slowly building the user defined swatch library up by adding one image at a time and then adding back into the Swatch panel the previously built up library of swatches again one at at time. (you can select all from the existing user defined library and drag over into swatch panel, but this creates at least one duplicate on each cycle for as soon as you click on the first swatch in the library, it adds itto the current swatch panel and then when you select all swatches to drag across it includes the first swatch and copies it again)
This is a very slow process to build up a swatch library. For some reason you cannot drag swatches directly into the user defined library you have created, only into the active swatch window for each workspace. I searched the web and forums for answers but could find none. There must be an easier way, just can't find it.
Ideally, the best option would be a swatch window option that allows the import directly from a list of selected files in the finder.
View 4 Replies
View Related
Feb 4, 2013
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.
View 2 Replies
View Related
Sep 25, 2013
I can't figure out how to create outlines (vector lines) for my patterns , as I need to laser cut the pattern, and all the lines have to be seen I use Illustrator CS6.
View 3 Replies
View Related
Feb 16, 2014
i regularly have to print out colours for sublimating fabric, and use illustrator to create a panel of blends to print out.
I put four colours in the corners, make an 18 step blend or the top two, then the bottom two, expand them then ungroup them, and then change the blend options to 8 steps and blend them vertically one by one.
all in all it's several minutes work, but i thought i could change the values of the four corners, and then use actions to blend the grid.
initially it stopped and told me ungroup was unavailable, so i created smaller steps, but still can't get it to work.
is this possible, or do i carry on manually crating grids? or is there another way?
View 1 Replies
View Related
Mar 2, 2012
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.)
View 5 Replies
View Related