Script to select same stroke color and apply a new swatch...

I am trying to write a script that will select a line based on a swatch name, apply a new swatch, set the stroke, dash and miter of the line...and then create a new layer, change then name of the layer, and then move the selected items to the newly created layer.
All I could seem to accomplish was renaming a swatch.
var swatchName = app.activeDocument.swatches;
if (swatchName.length > 0) {
    for (i=0; i < swatchName.length; i++){  
        changeName(swatchName[i]);
function changeName(swatchObject){
                 if (swatchObject.name == "PANTONE Orange 021 C"){                     
                    swatchObject.name = "021 (Orange)";
                if (swatchObject.name == "PANTONE Red 032 C"){                     
                    swatchObject.name = "032 (Red)";
So the goal of what I would like it to do is look for all paths with the stroke color set to "PANTONE Orange 021 C" then have it change the swatch name to "021 (Orange)". After that apply the stroke, dash and miter. Create a new layer named "021 (Orange)". Then send all of the selected lines to that layer.
PLEASE HELP AS I HAVE 200+ files to do this task to. Using a windows machine with CS3. Trying to write in javascript.

This would be the way to rename 2 existing swatches… The GUI pallet can be a little sticky in updating but it works…
#target illustrator
var docRef = app.activeDocument;
var a = docRef.swatches.getByName('PANTONE Orange 021 C');
a.name = '021 (Orange)';
var b = docRef.swatches.getByName('PANTONE Red 032 C');
b.name = '032 (Red)';
redraw();
My mistake… Looks like this Jive stuff gave you an unwanted bump from nowhere? Didn't look at the date…

Similar Messages

  • Select same fill color and stroke color

    Hi
    any one help me to select same fill color with help of java script and stroke colot too
    Thank
    Appu

    Not saying it cant be scripted but what about just via the Illustrator "Select" menu:
    Examples:
    Select > Same > Fill & Stoke
    Select > Same > Fill Color
    Select > Same > Stroke Color

  • Select path with same swatch and apply a new swatch

    I am trying to write a script that will select a line based on a swatch name, apply a new swatch, set the stroke, dash and miter of the line...and then create a new layer, change then name of the layer, and then move the selected items to the newly created layer.
    All I could seem to accomplish was renaming a swatch.
    var swatchName = app.activeDocument.swatches;
    if (swatchName.length > 0) {
        for (i=0; i < swatchName.length; i++){  
            changeName(swatchName[i]);
    function changeName(swatchObject){
                     if (swatchObject.name == "PANTONE Orange 021 C"){                     
                        swatchObject.name = "021 (Orange)";
                    if (swatchObject.name == "PANTONE Red 032 C"){                     
                        swatchObject.name = "032 (Red)";
    So the goal of what I would like it to do is look for all paths with the stroke color set to "PANTONE Orange 021 C" then have it change the swatch name to "021 (Orange)". After that apply the stroke, dash and miter. Create a new layer named "021 (Orange)". Then send all of the selected lines to that layer.
    PLEASE HELP AS I HAVE 200+ files to do this task to. Using a windows machine with CS3. Trying to write in javascript.

    This would be the way to rename 2 existing swatches… The GUI pallet can be a little sticky in updating but it works…
    #target illustrator
    var docRef = app.activeDocument;
    var a = docRef.swatches.getByName('PANTONE Orange 021 C');
    a.name = '021 (Orange)';
    var b = docRef.swatches.getByName('PANTONE Red 032 C');
    b.name = '032 (Red)';
    redraw();
    My mistake… Looks like this Jive stuff gave you an unwanted bump from nowhere? Didn't look at the date…

  • Select same fill color/stroke color but not for entire document

    As the title imply's, I am wondering if there is a way to use the "select same fill color" and/or "stroke color" for just a group of objects in a document as opposed to document-wide.
    Thanks for any help you can provide!
    Tony

    Did you make the group into an isolation group?
    ( in the Control bar.)
    Or else you can select the objects you want to change, then Select Inverse and lock or hide.
    Isolation groups are usually handy for this kind of work though.

  • Mac 10.6.7:    I have scanned our clubs logo which is green on a white background.  Is there a program on my Mac which will allow me to select the green color and make it any color I wish?

    Mac 10.6.7:    I have scanned our clubs logo which is green on a white background.  Is there a program on my Mac which will allow me to select the green color and make it any color I wish?

    Hi,
    Without knowing what is on your Mac it is a little difficult to say.
    Photoshop Elements will do it (Use the Magic Wand to select the area then Paint it).
    GraphicConvertor comes bundled on some Macs and can do it.
    10:29 PM      Friday; May 27, 2011
    Please, if posting Logs, do not post any Log info after the line "Binary Images for iChat"
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb( 10.6.7)
     Mac OS X (10.6.7),
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • Is it possible to write a script that samples an anchor points underlying color and applies it?

    I was wondering if anyone with scripting knowledge for Illustrator can think of a script that would sample the underlying color of anchor points in a selected gradient mesh and apply it to them? I was just thinking of ways to speed up the process of creating a vector drawing based on a picture so that all you would have to do is model your mesh and then let the script apply the colors.
    Thanks

    no can do, there's no access to mesh point with scripting, sorry about that.
    have you tried Mesh Tormentor? it is free!!!, but I don't know if it will help with your problem
    http://www.meshtormentor.com/

  • How to change Object Stroke Color and fill Color?

    Hi to all
    i need to change fillcolor & stroke color of Object
    here i wrote code that tried but it is not
    myDoc = app.activeDocument;
    var dd = myDoc.colors.add({name:"PANTONE Black C", model:ColorModel.spot, colorValue:[0, 13, 49, 98]});
    app.findObjectPreferences= NothingEnum.NOTHING;
      app.changeObjectPreferences = NothingEnum.NOTHING;
      app.findObjectPreferences.fillColor = "Black";
      var myI1 = myDoc.findObject();   
       app.changeObjectPreferences.fillColor = "PANTONE Black C // here error throwing
        app.changeObject ();
    app.findObjectPreferences= NothingEnum.NOTHING;
      app.changeObjectPreferences = NothingEnum.NOTHING;
      app.findObjectPreferences.strokeColor = "Black";
      var myI2 = myDoc.findObject();   
       app.changeObjectPreferences.strokeColor = "PANTONE Black C // here error throwing
        app.changeObject ();
    Error is :  Invalid value for set property 'fillcolor' ,Expected Swatch, String or NothingEnum enumerator, but received "PANTONE Black C";
    pls help me...
    Thanks
    Thangaraj

    Hi scriptor,
    how to create find change query for object search
    pls tell me with script.
    here i attached one jpg file screen shot to understand my need
    Thanks
    Thangaraj

  • Problem with stroke color and weight

    I have an illustration of a chair I am working on using Illustrator CC.  It is made up of a combination of shapes and open paths.  In order to get the illustration filled correctly I used live paint to fill the open paths.  I was in the process of adjusting the stroke weight and colors but one stroke will not allow me to make any changes.  The stroke color is marked witha  question mark and the weight will not change at all.
    Update:  I have since posting this copied my artwork and pasted it into a new document.  I was able to correct the stroke on the problem path, but now there is an entire section of the chair which will accept no fill...
    Any help is appreciated.

    If I were you I would provide a sample .ai file and include some instructions to reproduce the issue you're talking about.

  • STARTED IT, BUT STILL NEED HELP -- INPUTTTING CHARACTERS FROM LOADED FILE INTO TABLE, SELECTING STRINGS FROM TABLE AND PLACING IN NEW TABLE, SAVING NEW TABLE TO SPREADSHEET FILE

    I AM TRYING TO IMPORT CHARACTERS FROM A TAB DELIMITED FILE INTO A TABLE ON LABVIEW.  ONCE THE DATA IS IN THE TABLE I WANT TO BE ABLE TO SELECT INDIVIDUAL STRINGS FROM THE TABLE AND PLACE IT IN A NEW TABLE.  WHEN I CLICK ON A STRING I WOULD LIKE THE SELECTED STRING TO SHOW IN A TEXT BOX LABELED 'SELECTED STEP'  AFTER ALL THE SELECTED STRINGS IS IN THE TABLE I WOULD LIKE TO SAVE THE NEW TABLE AS ANOTHER SPREADSHEET -- TAB DELIMITED -- FILE, MAKING IT ACCESSIBLE TO OPEN.  HERE IS WHAT I HAVE SO FAR.  I CAN INPUT DATA INTO THE TABLE, BUT I CAN ONLY TRANSFER ONE STRING INTO THE TABLE I WOULD LIKE TO BE TO INPUT MULTIPLE STRINGS.    ALSO WHENEVER I TRY SAVING THE FILE, IT ALWAYS SAVES A UNKNOWN FILE, HOW CAN I GET IT TO SAVE AS A SPREADSHEET FILE.  THANKING ALL OF YOU IN ADVANCE FOR YOUR HELP!!!!!!
    Attachments:
    Selector.zip ‏30 KB

    Pondered,
       The question you are asking is the same one that you asked in: http://forums.ni.com/ni/board/message?board.id=170&message.id=132508#M132508, to which I supplied a revised version of the original vi you used (which was modified from the original one I supplied to an earlier thread). A couple of questions: 1) What does my latest not do that is in your question, 2) Why are you starting yet another thread about the same problem?  We are here trying to help, it makes it a lot easier if you keep the same problem in the same thread, it reduces duplication of effort from those that might not have been following the previous thread(s).  Those of us that don't have our "names in blue" are just doing this "for fun" (the blue names are NI employees, who may still be doing it "for fun"), and it makes it more fun if it doesn't seem (correctly or not) that our attempts are ignored.  If an answer doesn't help, or seems incomplete, post a little more detail to the same thread so that the original respondent, or someone new, can provide more information, or understand your problem better.
    P.M.
    Message Edited by LV_Pro on 07-20-2005 01:20 PM
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Search for string in paragraph and apply a new character style?

    I'm searching for a way to find a specific string in a specific text frame and make it bold. so my thought was to search and then apply a character style from my template doc. I thought this would work, but I went wrong somewhere.
    newDoc is my document. 
    //something like
    var Bios = "Representative Biography:\r want to leave this text normal.";
    var myTextFrameBios = newDoc.pages.item(i).textFrames.add({geometricBounds:[4.5277, 2.36, 8.625, 5.375], contents:Bios});
    var myTextObjectBios = myTextFrameBios.parentStory.texts.item(0);
    // IS THIS CONFLICTING with my change below? Can I apply a character style within a par styled frame?
    myTextObjectBios.appliedParagraphStyle = newDoc.paragraphStyles.item("CompanyProfile");
                                                      //Clear the find/change preferences.
                                                    app.findGrepPreferences = NothingEnum.nothing;
                                                    app.changeGrepPreferences = NothingEnum.nothing;
                                                    app.findTextPreferences.findWhat = "Representative Biography:";
                                                    app.changeTextPreferences.changeTo = "Representative Biography:";
                                                    app.findGrepPreferences.appliedCharacterStyle = newDoc.characterStyles.item("BoldBioHead");
                                                    // Perform the operation
                                                    app.documents.item(0).changeGrep();
                                                    app.findGrepPreferences = NothingEnum.nothing;
                                                    app.changeGrepPreferences = NothingEnum.nothing;

    @caseyctg – If you want to apply a character style to a text object in a specific text frame, you could restrict the scope of your script to that specific text frame:
    Example with the variable "myTextFrame" you have to define before:
    myTextFrame.changeText();
    Btw.: you are doing a text search and clearing your GREP find/change preferences at the start of the snippet? Why is that?
    You could do a:
    app.changeTextPreferences = app.findTextPreferences = NothingEnum.nothing;
    or:
    app.changeTextPreferences = app.findTextPreferences = null;
    set before the search and after the change, if you want to be on the safe side…
    Uwe

  • Oracle 10.2 client for linux  and applying the new October Critical patch

    We are using the Oracle 10.2 client on one of our linux workstations.
    I can not find out if this new oracle critical patch October 05 needs to be applied to
    this client. Also, does anyone know if the Oracle 10.2 client already includes the patch updates for the alert 68 patchset? Our Oracle Sever runs on a solaris operating system which will be updated with the new critical October patch, but
    the linux client runs on a separate workstation.
    Thanks,
    Dave

    See my response to this posting.
    Oracle Security Patches

  • How can I apply a current fill color to a stroke, then adjust that stroke color's build?

    Hi all, 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 helps to 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. Thanks for the help!

    ok try this one, I added the spot color option
    // make stroke color same as fill color + 15% black increase
    if ( app.documents.length > 0 && app.activeDocument.pathItems.length > 0) {
        for (var a=0; a<app.selection.length; a++) {
            try {
                    var sel = app.selection[a];
                    var fillcolor = sel.fillColor;
                    if (fillcolor.typename == "CMYKColor")
                        var cmkycolor = fillcolor;
                    else if (fillcolor.typename == "SpotColor")
                        var cmkycolor = fillcolor.spot.color;
                    var col = new CMYKColor;
                    col.cyan = cmkycolor.cyan;
                    col.magenta = cmkycolor.magenta;
                    col.yellow = cmkycolor.yellow;
                    var black = cmkycolor.black + cmkycolor.black +15;
                    col.black = black>100 ? 100 : black;
                    sel.strokeColor = col;
                    sel.strokeWidth = 0.5;
            catch (e){alert(e)

  • Why do you need to shift click to select stroke color with eyedropper tool?

    Hi,
    Quick question..
    Why do you need to shift click to select the stroke color with the eyedropper tool?
    I had the problem where I could not do this earlier and found the solution on this forum.
    However I still do not understand the reason for this.
    Appreciate if anyone could explain it to me.
    Thanks in advance.
    Nori

    Hi, Nori,
    If you have the red and blue rectangle selected and the Fill square selected in the tool panel, as at bottom left, then hold the shift key down and click with the eyedropper on the green stroke in the upper rectangle, then the red fill will turn green but the stroke stays blue. If you select Stroke, as at bottom right, then shift-click with the eyedropper on the green stroke, the blue stroke will turn green but the fill stays red. With Fill selected and shift-click on the yellow fill, the red fill turns yellow; with Stroke selected the blue stroke turns yellow. If you do not depress the shift key, the red and blue rectangle will become yellow and green.
    It's complicated to explain, but I think that if you try it step by step it will make sense to you.
    Peter

  • How to make colors look same in illustrator and Flash Builder

    We had a designer build out our UI using Adobe illustrator, and then tried to replicate the same hex color and alpha codes in Flash Builder- colors are looking very different on the same machine
    We have used basic web colors but the problem persists. Any pointers on why this could happen?

    Thanks Joan... we managed to figure out the cause to a large extent- problem
    arisen by the way the layers were built in Illustrator vs Flashbuilder. I
    still have the following questions, that we are currently handling via a
    workaround
    a) when I try to skin the container using SkinnableContainer, the skin
    doesn't take effect- but works, when I use same skin with a BorderContainer.
    Any idea of why this is so?
    The code used is as below
    <s:BorderContainer id="Banner" height="15%" width="100%"
    skinClass="mySkins.newskin1">
    <mx:Image id ="logo" source="assets/graphics/logo.png"
    x="{0.018Banner.width}" y ="{.09Banner.height}"
    height="{Banner.height*0.7}" maintainAspectRatio="true"
    width="{Banner.width*0.085}"/>
    <s:Label x="{0.065Banner.width }" y ="{.293Banner.height}"
    fontFamily="Copperplate" fontSize="34" kerning="on" color="#666666"
    text="EUREKA WORLD"/>
    <s:Label x="{.88Banner.width}" y ="{.293Banner.height}" fontFamily="Arial"
    fontSize="14" kerning="on" color="#666666" text="Help | Log Out"/>
    <s:Label x="{.865Banner.width}" y ="{.45Banner.height}" fontFamily="Arial
    Bold" fontSize="18" kerning="on" color="#666666" text="Welcome Gauri"/>
    </s:BorderContainer>
    Skin attached
    b) we are trying to replicate the design from Illustrator(exported in fxg
    format) and replicate in FlashBuilder. We would like to name the objects
    meaningfully so we can connect the front-end with names in the fxg code.
    Currently we see an objID. How do we name objects in Illustrator?
    c) When we use a mx:vbox within a repeater to display contents of an array,
    we had trouble skinning this for background color- compromise we reached was
    to have the background color in the mx:vbox with a skinclass for the border
    and shadow
    Regards

  • "Select Same..." Just as in Illustrator in Indesign?

    Hello All-
    Just wondering if anyone knows if there are any Indesign plug ins or scripts that work similar to Illustrators "Select Same..." feature of finding objects, type & strokes of the same color, value as what youhave already selected.
    I work in pre-press and we have clients who spec their type in odd colors (0% black, Registration Color, or in an RGB color which isnt even in their color pallet)
    Specificaly in text, it would be great to have a tool that shows what text is colored and where. What objects or anything may be in RGB, because often the color isnt in their pallet. We have these booby traps all the time and it is hard to manually catch them all.
    Any direction to such a plug-in or script or advice would be appreciated!
    DA

    DA,
    Select same wouldn't work in ID as you would only be able to select stuff on a single spread.
    But have you looked at the selection options in the Find/Change by Object attributes?
    That feature is actually more robust than the Illustrator "Select Same" commands.
    You can find objects with a certain stroke color and a specific stroke weight.
    You can search for objects by corner options, transparency attributes, text wrap options, and so on.
    It is so much more powerful than Illustrator!
    And you can save complicated queries for future work.
    Oh, even BETTER than Illustrator.
    You can also APPLY formatting using that dialog box. Much more powerful than Illustrator.

Maybe you are looking for

  • Optimize the following update on per_all_assignments_F

    Hi I am trying to optimize this sql which is taking a long time to complete. declare cursor c1 is select person_id, annual_rt from xxdl.xxdl_papf_scrambling_view; begin for i in c1 loop update PER_ALL_ASSIGNMENTS_F set as_attribute4 = i.annual_rt whe

  • Mapping MIDI sounds in GB3

    I record drum tracks via my Roland V-Drums and Cakewalk/Sonar. I save them as .mid files then drag them on to my GB3 app for playback. Does anyone know how to change the instrument assignments in GB3? Not all the sounds from my drum kit are audible a

  • Wishlist for ipad

    I'd like very much a daap improvement in ipad... not only family sharing to share music!!! this is pathetic for a nas server support (daap!!!) thanks!!!

  • Long Datatypes in Reports

    I have a field of long datatype in a table. I need to display the first 200 characters of this field in a report. How can I do this. If it is thru Placeholder columns can you explkain in detail how I should go about this. null

  • PS 5.0 moving to XP 64-bit - not compatible?

    I've just migrated to a new work station that runs Windows XP 64-bit.  My Premier Pro, Encore DVD, After Effects, and Audition programs all installed without a hitch.  When I went to install my PS 5.0, I got an error message stating it will not work