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…

Similar Messages

  • 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…

  • HT4352 problem sharing iTunes with new Apple TV.(model MD199LL/A. I have iTunes and Apple TV set up with same address and passwords, enabled iTunes and Apple TV for home sharing and still nothing? I have latest iTunes and Apple TV update. Any other sugges

    Have a problem with Home Sharing with Apple TV and iTunes. Have latest iTunes and Apple TV downloads. Have both items set up for home sharing with same address and passwords. AppleTV running fine for everything else. FYI, my library is about 60gigs. AppleTV model is MD199LL/A if that matters. Really want to hear my entire music library and not just Purchased items. Thanks for any help!!!

    I have an older PC with Windows XP Professional on it. I updated to the latest iTunes and I am able to access the photos, etc. on it. However, my Windows 7 PC still does work (since last Apple TV update). Apple TV does not recognize that Home Sharing is turned here. The latter PC has all my current photos on it which I would like share with others on my Apple TV. A fix would be appreciated.

  • I need some help resizing my images on PS6. I am using a mac and have been trying to resize with same resolution and constaining proportions but for some reaseon the smaller resized image appears pizelated.

    I need some help resizing my images on PS6. I am using a mac and have been trying to resize with same resolution and constaining proportions but for some reaseon the smaller resized image appears pizelated. Heres an image of before and after. The first image I use is a JPG 72dpi 1500px x1500px and I want to downsize it to 600x600px same res, but it keeps pixelating, this has never happened before. Any suggestions, thoughts?
    thanks!

    I wouldn't say pixelated; more like blurry.
    Like ConnectedCreative said, what steps are you using? Are you using "bicubic sharper" when resizing down?

  • Absolute dynamic select query with dynamic join and where

    Has anyone ever tried creating an absolutely dynamic SELECT query with dynamic Join and Where conditions.
    I have a requirement of creating such a query in an Utility Class, and i have written the code. But its throwing my sysntax errors.
    Please let me know where am I going wrong OR is it really possible to create such a dynamic Query??
        SELECT (FIELDS) INTO TABLE IT_TABLES
          FROM ( (ME->TABLE1)  inner join ( me->table2 )
          on ( on_condition ) )
          WHERE (me->where_fields).
    Ags.

    It worked for me in a following way:
    select * into corresponding fields of table <result_table>
            from (join_string)
            where (l_where).
    Where the contents of join_string were dynamically build using concatenation. So it will be something like
    concatenate ME->TABLE1 'as a INNER JOIN' me->table2 'as b ON (' into join_string separated by space.
    <...>
    add here matching/reference colums, something like
    concatenate 'a~' me->TABLE1_JOIN_COL into temp1.
    concatenate 'b~' me->TABLE2_JOIN_COL into temp2.
    concatenate join_string temp1 '=' temp2 into join_string separated by space.
    <...>
    concatenate join_string ')' into join_string separated by space.
    And then use similar approach for l_where variable.

  • I need only to select node with "NodeName" (or/and Number) in a Java Tree

    I need only to select node with "NodeName" (or/and Number) in a Java Tree. Can anybody help me? Thanks a lot

    http://www.jetbrains.com/idea/openapi/5.0/com/intellij/util/ui/tree/TreeUtil.html
    http://www.tangoone.com/swf/docs/javadocs/org/swf/components/TreePane.html
    I fin SelectNode() function here - but I don't know how to connect these clases

  • Database restore with same SID and different schema owner

    Dear all,
    I have quality system on HP-UX oracle platform which has been upgraded from 4.6C to ECC 5.0
    and schema owner for the database is still SAPR3
    I have installed new Test system with version ECC 5.0 with same SID and now i need to refresh its database with Data from QAS system ... owner at Test system is SAPC11 which is new installation ECC 5.0 and where SID is C11.
    I need to know once i restore data what steps i need to carry out at Test system
    i.e like change ENV settings from SAPC11 to SAPR3.
    Please note SID is same on both hosts. and owner is different SAPR3 and SAPC11
    Regards,
    RR

    Dear all ,
    Thanks for your views . but i have already installed ECC 5.0 on
    target machine with schema owner as default SAPC11 (sid)
    Is there any other way out ... instead of doing reinstallation with schema owner SAPR3 / instead of doing Export-Import system copy method which again is as good as reinstallation.
    I would like to have your views on following ,
    when i will restore database from source to taget
    al tables in target machine will be having owner as SAPR3 ( which came from source ) ...but my DB owner at Target machine is SAPC11 ( as far as ENV and all profiles are concerned ) .... cant i use SAPR3 user which got restored with backup of source to target to start my instance at Target machine... may be by changing ENV settings.
    I really appreciate and thank you in adavance for sharing your views.
    Regards,
    RR

  • Create a different db with same db_name and now cannot start apex

    Hi All
    we create a db in the same box with my old db.
    The purpose is we need to change the default character set to unicode.
    And How do we start apex?
    Is there a command line tool to start apex?
    -Thanks for the help!

    Hi umesh,
    Thanks for your help.
    That means we can set up two database with same db_name and domain is system. the duplicate DB (second DB) does not affect primary DB in system and makes a confusion for client application? suppose i use TNS to control each DB by IP .
    also, can we use db_link to link two differnet OS plastform( window 32 bit and linuc 64 bit redhat with service name) oacle version is 10 g too?
    I try to configure a TNS in primary DB tnaname file but fail with TNS : no listener ora-12541 during connect linux DB server.
    But I copy this TNS to new window 32 bit PC with oracle client. it works to link to linux db services.
    which issue?
    Thnak for help
    JIM
    Edited by: user589812 on Jul 3, 2009 9:00 AM

  • Send 837, 276 & 270 to same Trading Partner with Same Receiver and Submitter ID

    Hi,
    I am trying to send different EDI to same Trading partners using same Receiver and Submitter Identifiers, but for different ISA15 and GS8.
    When I tried to add another Agreement using same identifiers, BizTalk throws errors 
    Cannot save changes as it will result in two oneway agreements in agreements [Agreement_837] and [Agreement_276] to have same sender and receiver identities [ZZ:SenderID] [ZZ:ReceiverID]. (Microsoft.BizTalk.B2B.PartnerManagement)
    I thought of using dummy ID and change it in Send Pipeline component with same Submitter and Receiver ID. But seems its a BAD idea. Is there anything I missed ?
    Any suggestions / help is highly appreciated. Please help
    Thanks,
    harry
    BizTalk Developer

    You should be able to set GS08 on the Envelopers section of the You->Them tab of the agreement.  You can set per transaction.
    Unfortunately, ISA 15 is an Agreement level option and as you've seen, a unique sender/receiver combination is required.
    I recommend setting EdiOverride.ISA15 in either an Orchestration or Pipeline Component for the transactions you want different from the Agreement ('T' I'd presume).
    EdiOverride:
    http://msdn.microsoft.com/en-us/library/dd223988.aspx

  • I would like colored tabs; is it possible with Firefox? And or, each new subject have a different color tab.

    I would like colored tabs; is it possible with Firefox? And or, each new subject have a different color tab.

    The [https://addons.mozilla.org/en-US/firefox/addon/1368/ ColorfulTabs] extension may be of use to you.

  • I have an iMac that I bought back in 2008.  Ive kept uptodate with my OS and have the new Maverick.  I want to buy an Airport Time Capsule (2TB).  Is this going to be compatible?

    I have an iMac that I bought back in 2008.  Ive kept uptodate with my OS and have the new Maverick.  I want to buy an Airport Time Capsule (2TB).  Is this going to be compatible?

    Yes, absolutely.

  • Results for my browser has prob with 1st inch and harf from new babbilon crap will not hipolink i can not sign in or register on any thing please help

    results for my browser has prob with 1st inch and harf from new babbilon crap will not hipolink i can not sign in or register on any thing please help

    has anyone solve this problem? i upgraded my iphone 4 to 5.1.1 and now i can see only ""We're sorry, we are unable to continue with your activation at this time.  Please try again later, or contact customer care."
    i tried mani sim card, laptops, wifi. but for 7 days the problem is still exist....
    Please help me!!!

  • How to select same font and apply auto kerning?

    How to select all text frames with same font (for example 'NewCenturySchlbk-Roman') and apply auto kerning?
    Thanks.

    For all opened documents:
    for (i = 0; i < app.documents.length; i++) {
        var targetDocument = app.documents[i];
        activeDocument = targetDocument;
        var docRef = app.activeDocument;
        for (var w = 0; w < docRef.textFrames.length; w++) {
            var textRef = docRef.textFrames[w];
            if (textRef.textRange.characterAttributes.textFont == textFonts.getByName('NewCenturySchlbk-Italic')) {
                textRef.textRange.characterAttributes.kerningMethod = AutoKernType.AUTO;
    redraw();

  • How to select paths with the same stroke width

    I would like to know how to select all the paths inside a document whose stroke width are equal to 0.361 points
    I will appreciate any help.

    here you go
    #target illustrator
    // script.name = selectPathsThisSize.jsx;
    // script.description = selects pathItems that have the same supplied stroke width; limited to 3 decimals;
    // script.required = a document with at least one path item;
    // script.parent = CarlosCanto // 6/5/11;
    // script.elegant = false;
    var idoc = app.activeDocument;
    var strokewidth = prompt ("Enter Stroke Width in points of paths to be selected", 0.361, "Select Paths this size:___");
    for (i=0 ; i< idoc.pathItems.length; i++)
              var ipath = idoc.pathItems[i];
                   if ( (ipath.strokeWidth).toFixed(3) == Number(strokewidth).toFixed(3))
                             ipath.selected = true;
    app.redraw();

  • Path with anchor points and bezier control handles

    I have a text, not converted to outline. Live text.
    I am using IllCS4.
    That is cool thing about hovering the cursor above the text and see hidden path and anchor points only when you hovering exactly above them. But I want them be visible permannently, while I am applying some envelop distort  changes. Then I want to turn visibility off. And how to get permanent visiblity of bazier control handles at  the same time?
    I am lost.
    Tx

    Yes, thank you,
    that is great thing, but when I use it, I see outlines (like a wireframe) of image  only.
    Is there any way to see still image as it is and switch on visibility of object' path with all control points?

Maybe you are looking for