Apply Fill Color to Group Item with Applescript

Is it possible to set the fill color of a group item using applescript and CS3? The group contains paths and text that have the same fill color with no strokes.I am able to select the group and delete it or move it (with applescript) but have had no success in setting the fill color.
Thank you in advance for help on this question. And thanks for everything I have picked up from browsing.

Now that I am addressing the path items and text items of the group separately I am having some success. Now I am having difficulty getting the correct terms for assigning a Spot Color to the file. Here is a piece of the script.
This works:
tell application "Adobe Illustrator"
set openDoc to document 1
set ftClr1 to (first group item whose note is "Front3") of openDoc
set ftClr1Paths to path items of ftClr1
repeat with thisPath in ftClr1Paths
set fill color of thisPath to {red:255}
end repeat
set textFrames to text frames of ftClr1
repeat with thistext in textFrames
set fill color of every line of thistext to {red:255}
end repeat
end tell
Need help to set the fill color to a Spot Color that already exists in Swatches.
Thanks
Nick

Similar Messages

  • [AS] CS3- Find any text with style, then replace that text with a new applied fill color.

    I am trying to find the simplest way in cs3 to find any text with style, then replace that text with a new fill color. I can find text and change text. I can find a style and change it to a new style. I can't seem to find a style and change the applied fill color. I do not want to change the properties of the style, just the applied color. Yes, I want the + sign, for now. I know, why not update the style, I am not allowed to. Any help would be great. Since the search is not available, I need a new response.
    Thanks.

    You can work around the bug by just doing a find, then looping through the<br />results, changing the color one at a time. It'll be a fraction slower, but<br />should do the trick:<br /><br />tell application "Adobe InDesign CS3"<br />    set find text preferences to nothing<br />    set properties of find text preferences to {applied paragraph style:"The<br />name"}<br />    set theFinds to find text document 1<br />    repeat with i from 1 to count of theFinds<br />        set properties of item i of theFinds to {fill color:"Replace color"}<br />    end repeat<br />end tell<br /><br />The bug is fixed in CS4, BTW.<br /><br />-- <br />Shane Stanley <[email protected]><br />AppleScript Pro Florida, April 2009 <a href=http://scriptingmatters.com/aspro>

  • Draw rectangle and apply fill color

    Hi
    anyone help me to draw rectangle outside artboard and apply fill color
    i want to draw 10 rectangle of same size and apply fill color using javascript
    Thak you
    appu

    Now that I am addressing the path items and text items of the group separately I am having some success. Now I am having difficulty getting the correct terms for assigning a Spot Color to the file. Here is a piece of the script.
    This works:
    tell application "Adobe Illustrator"
    set openDoc to document 1
    set ftClr1 to (first group item whose note is "Front3") of openDoc
    set ftClr1Paths to path items of ftClr1
    repeat with thisPath in ftClr1Paths
    set fill color of thisPath to {red:255}
    end repeat
    set textFrames to text frames of ftClr1
    repeat with thistext in textFrames
    set fill color of every line of thistext to {red:255}
    end repeat
    end tell
    Need help to set the fill color to a Spot Color that already exists in Swatches.
    Thanks
    Nick

  • The color of text item with multi-line in web

    I tried to change the background color of text item with multi-
    line, but it does not work when I run in the web, if some body
    knows that, please give a hint.
    Thanks
    Frank
    null

    I tried to change the background color of text item with multi-
    line, but it does not work when I run in the web, if some body
    knows that, please give a hint.
    Thanks
    Frank
    null

  • Applescript to change color of path items with specific swatch from swatch group, multiple times

    I am attempting to take a path item that is on its own layer and change its color multiple times, saving it each time.
    I was able to do it with javascript however can't get it to work in applescript.
    Javascript:
    (Items are already selected that I intend to change.)
    var iL = app.activeDocument.pathItems.length;
    var colorSwatches = app.activeDocument.swatchGroups.getByName('newColors');
    var allColors = colorSwatches.getAllSwatches();
    var colorNames = Array();
    for (var i = 0; i < allColors.length; i++){
        colorNames.push(allColors[i].name);
    for (x = 0; x<colorNames.length; x++)
            var currentColor = allColors[x].name;
            for (i=0; i<iL; i++)
                var myItem = app.activeDocument.pathItems[i];
                if(myItem.selected)
                    myItem.fillColor = app.activeDocument.swatches.getByName(currentColor).color;
    (I then go on to save each one)
    When trying to cross over into applescript I have the following so far:
                   set iL to count every path item of document 1
                   set colorSwatches to swatchgroup "newColors" of current document
                   set allColors to get all swatches colorSwatches
                   set swatchCount to count every item in allColors
                   repeat with i from 1 to swatchCount
                        set currentSwatch to item i of allColors
                        repeat with x from 1 to iL
                            set myItem to path item i of document 1
                   here is where I have no idea what I am doing... I can't figure out how to test if an item is selected
                            if myItem's has selected artwork is equal to true then
                                set fill color of myItem to {swatch:currentSwatch}
                            end if
                        end repeat
                   end repeat
    Or better yet is there a way I can select every path item of a layer and change its color that way?
    Something like the following:
              set fill color of every path item of layer "art" of document 1 to {swatch:currentSwatch}
    Thanks for any input!

    I'm throwing it into a Applescript OBJc project I am working with. I currently have it in a javascript file within the actual project however this is the slowest part of my project and I'm going to attempt to speed it up some.
    Let's say I'm changing the color of a path item 35 times... this starts to eat a ton of time up.
    My applescript save illustrator file as jpeg is much faster than the javascript one for some reason...
    It's also something I have needed to do numerous times in the past and never got around to asking.

  • Problem with applying fills & strokes to grouped objects in Illustrator CC

    I have this problem that I deal with everyday & I can't figure out how to fix it.
    I am always struggling with applying fills & strokes (or changing fills & strokes).
    It seems like I always have to ungroup the objects first (even if I never grouped them in the first place), or I have to clear appearance first. Sometimes I have to ungroup several times, even if it is only one object by itself, not grouped with anything else.
    I think It may have something to do with the pathfinder... like the pathfinder is creating groups when I use the divide filter.
    Even when I use the direct selection tool, to select just the object I want, it wont let me apply the fill or stroke that I want.
    Also, it seems like it has several layers of appearance... when I ungroup the object, it changes appearance (the fill or stroke changes).
    Also, if I eyedrop the object to apply its appearance to another object, the "hidden" appearance is the one that gets appled to the new object.
    The closest discussion I could find was about compound paths, but I think this is a different issue, because when I go to compound paths in the menu, it doesn't give me the option to release anythig.
    I have this problem ALL DAY LONG, every day. Please help!!

    Thanks for your reply!
    I see what you are saying, and I think is some cases that could be a helpful trick - but the problem I'm having is slighlty different.
    The object that I want to change doesn't show the actual appearance... it only shows its underlying appearance after ungrouping several times, and then when it is completely ungrouped, it visibly changes to another fill & stroke. This happens even when the object is not grouped with anything... it is just grouped to itself i guess & I am not grouping these items, they just become grouped somehow - I think because of the pathfinder. I often have to ungroup 3-5 times, which is a hassle in iteself... but sometimes I actually need to grouping to keep items togther so I can manage all the ojects & move them around as needed.
    So... the method you are suggesting could possibly solve the issue, except I don't know what the fill & stroke is until I ungroup everything, so I can't create the swatch off to the side to match it. The other thing is, it seems like I would be creating a lot of swatches, since I use lots of different fills & it seems like it would be a lot of extra work.
    Here is an example of 2 objects before using the pathfinder. Please note how the object selected & the fill & stroke boxes all jive:
    Now here are two images after using the pathfinder tool (I added another object to get the problme to happen). Please note how the fill & stroke boxes do not match the objects selected:
    This is what happens when I try to change the fill to green (the fill does not apply):
    I thought it had something to do with compound paths, but as you can see below, the menu doesn't give me an option to release compound paths:
    The final image is what happens after I ungroup the objects:
    I don't understand:
    1) why pathfinder is grouping these objects
    2) why the strokes & fills change & why the fill & stroke boxes don't match the actual fill & stroke.
    3) why I can't change the fill or stroke without ungrouping (even when using the direct selection tool).
    4) why the fill & stroke change again after ungrouping

  • Apply Random Color to Group of Objects

    Hello all, thanks for taking the time to help.
    Here's my issue... lets say I have 600 different objects in illustrator (just little circles with a fill color, no stroke) and 6 different colors that these circles should be. That means, I'd like about a 100 to be one color, 100 another color, etc... Is there anyway to select all 600 and just tell Illustrator that I have these 6 colors and I want to apply them to the selected objects randomly?
    Let me know if this is confusing... hopefully there is some option to do this. I don't want to apply them manually...
    Thanks!

    Rats. The [none] (no-color) swatch is stubborn.
    I was able to remove the [registration] swatch from the mix by making sure it's at the head of the palette and adding a (If swatchIndex>1) test to the script. But I can't get rid of the [none] swatch no matter what I do. Illustrator must treat it as a special case so that it cannot be referred to by index number.
    Help, James!
    One other thing: Not for nothing, but...
    lets say I have 600 different objects in illustrator (just little circles with a fill color, no stroke) and 6 different colors that these circles should be. That means, I'd like about a 100 to be one color, 100 another color, etc.
    ...is not exactly the same thing as...
    select all 600 and just tell Illustrator that I have these 6 colors and I want to apply them to the selected objects randomly
    What you want is a uniform distribution of those six colors but in no discernible pattern. That's not true random assignment, and this script won't get you there even if got the unwanted swatches out of the mix.
    No obvious solution here.

  • Filling in an InDesign Template with Applescript

    I also posted this in an InDesign scripting forum, but I thought I'd see if anyone here had any ideas.
    I'm working on a script to fill in an InDesign template I've created. The template consists of 8 text frames, each with a logo placed as an in-line graphic. What I need the script to do is to add text it has gathered after the in lines after the logos. The text frames will all be identical, so I've been trying variations of:
    tell application "Adobe InDesign CS3"
    tell active document
    tell active page
    tell every text frame
    set paragraph 2 to label_info
    end tell
    end tell
    end tell
    end tell
    It seems like the problem is in getting InDesign to even recognize the text frames so I can work with them. Eventually, I will also need to set paragraph styles and export a PDF of the document, but I'm just trying to figure this out one step at a time for now.

    I got it to work.

  • AS-CS3- Fill color of any paths, what are "plugin items"?

    I had a script that used to work in Illy 9 or 10. Now in CS3 I found it does not work 100% properly. I have some artwork that contains some "plugin items" on the page. WTH are these and how can I manipulate them? I've checked the item's properties and can't find a way to get the fill color or path item kind of data.
    Here's what my old script did: Get each path item on the document, check it's fill color. If fill color total (ink total) is over 290 then either set it to be only 100% black, or select the item and warn the user.
    This script is run by various PrePress people and other artists. Assume that no one knows where the document came from or how it was made. I am attaching a sample document you can check out. It appears like the "tree" object has been made by the Pathfinder filter but was not expanded. I can not assume that I can expand the object, artwork must stay the same except for color changes.
    Here is my current script:
    tell application "Adobe Illustrator"
    tell document 1
    set myCount to count path items
    set selected of every path item to false
    repeat with i from 1 to myCount
    try
    set myColorSum to ((cyan of fill color of path item i) + (magenta of fill color of path item i) + (yellow of fill color of path item i) + (black of fill color of path item i))
    if myColorSum is 400 then set fill color of path item i to {class:CMYK color info, cyan:30.0, magenta:20.0, yellow:20.0, black:100.0}
    if myColorSum > 290 and myColorSum < 400 then set selected of path item i to true
    end try
    end repeat
    set mySelectedPaths to count (path items whose selected is true)
    if (mySelectedPaths > 0) then display dialog "If you have any items with color sums over 290 then they are selected for you now (some have been fixed automatically). Please fix them, and run this again to verify. Gradients must be checked manually!" with icon 2
    if mySelectedPaths = 0 then display dialog "Document is OK -or- all items have been corrected. Save your document." buttons "OK" default button 1
    end tell
    end tell

    Thanks, I had a look at your sample file and the only route I can see is the expand that you don't want to use. You may just have to add the plugin items to the things the user has to check manually. The only thing that you can really do with plug in items is alter the trace options if it is a trace. Sorry.

  • Edit Illustrator symbol with AppleScript

    Hello,
    Does anyone know if it is possible to edit an existing symbol in an Illustrator CS3 document with AppleScript? Specifically, what I'm trying to do is this: I'd like to manually create an Illustrator document that uses the "3D Extrude and Bevel" effect to map symbols to the surfaces of the 3D object. Then, I'd like to programatically open that Illustrator document, edit the existing symbols (so the surfaces of the 3D object are updated), and finally export an image.
    From what I've found in the AppleScript documentation PDF, I'm thinking this is not possible since it lists all the properties of a symbol object as read-only. But perhaps I'm overlooking something?
    If it is not possible, is there another way of doing what I'm trying to achieve?
    Thanks!
    Ben

    Ben, could you not have just swapped your symbols? like:
    set symbol of every symbol item to symbol "Foo"
    Justin, if it is essential that you need to crack open a symbol item then it may be possible using system events to expand the item may even be possible with a action for this part?
    This works for me. It is set to work with what items i know are available to my test doc.
    {1 symbol of >2 path items, 2 gradients swatches}
    tell application "Adobe Illustrator"
    activate
    set Doc_Ref to the current document
    tell Doc_Ref
    set x to width / 2
    set y to height / 2
    set ruler origin to {x, y}
    -- Make new layer to trash later
    make new layer at beginning with properties ¬
    {name:"Opened Symbol", visible:true}
    -- Place the symbol item you want to open
    make new symbol item at beginning of layer "Opened Symbol" with properties ¬
    {symbol:symbol 1, position:{0, 0}}
    -- Select the item
    set selection to symbol item 1
    -- Use system events to drive the GUI
    tell application "System Events"
    tell process "Adobe Illustrator"
    tell menu bar 1
    click menu item "Expand..." of menu "Object"
    delay 0.1
    keystroke return
    delay 0.1
    click menu item "Ungroup" of menu "Object"
    end tell
    end tell
    end tell
    -- List your items to edit
    set Symbol_Items to every page item of layer "Opened Symbol"
    -- Edit what ever you have here
    set fill color of path item 1 of layer "Opened Symbol" to {gradient:gradient 1}
    set fill color of path item 2 of layer "Opened Symbol" to {gradient:gradient 2}
    -- New group
    set New_Group to make new group item at beginning of layer "Opened Symbol"
    -- Move edited items into new group
    repeat with i from (count of Symbol_Items) to 1 by -1
    move (item i of Symbol_Items) to beginning of New_Group
    end repeat
    -- New symbol from group
    make new symbol at end with properties ¬
    {name:"My New Symbol", source art:New_Group}
    -- Replace instances
    set symbol of every symbol item to symbol "My New Symbol"
    -- Clean up
    delete every page item of layer "Opened Symbol"
    delete layer named "Opened Symbol"
    delete symbol 1
    end tell
    end tell

  • Apply new color to layers

    Hello!
    I would like to create a script in javascript  for Photoshop CC that does the following:
    1) Check each layer in the current document
    2) If the layer is named "fillMe" then color it in a specific color but lock the transparent pixels (in German it's called "Transparente Pixel fixieren")
    I imagine that there might be several ways to go about this. Maybe applying a "Color Overlay" layer style with the desired color would work.
    I have tried to find a good solution but cannot find any information on how to lock the pixel transparency with code. Also I would like to access a color picker window for the color selection.
    Could you kindly direct me to the right tutorials/resources?
    Thank you in advance!
    Edit: So far I have got this with the help of the Script Listener, but it won't run as "this function might not be available in the new version of Photoshop"
    function showBounds(layerNode) {   
        for (var i=0; i<layerNode.length; i++) {
            showBounds(layerNode[i].layerSets);
            for(var layerIndex=0; layerIndex < layerNode[i].artLayers.length; layerIndex++) {
                var layer=layerNode[i].artLayers[layerIndex];
                if (layer.name == "fillMe") {
                    layer.visible = 1;
                    layer.transparentPixelsLocked = 1;
                    var idFl = charIDToTypeID( "Fl  " );
                    var desc8 = new ActionDescriptor();
                    var idUsng = charIDToTypeID( "Usng" );
                    var idFlCn = charIDToTypeID( "FlCn" );
                    var idFrgC = charIDToTypeID( "FrgC" );
                    desc8.putEnumerated( idUsng, idFlCn, idFrgC );
                    executeAction( idFl, desc8, DialogModes.NO );
    showBounds(app.activeDocument.layerSets);

    Hi, thank you for your help!
    However, I'm having problems running the script. The first time it runs on a photoshop file it works fine, deletes all Color Overlay styles from "fillMe" layers and fills the according layers with the foreground color.
    When it runs a second time it always stops with the prompt "The command 'delete layer style' is momentarily not available" (or the German counterpart to that sentence).
    I tried to incorporate your code into mine, but I don't know what I'm doing wrong...
    function recolor(layerNode) {   
        for (var i=0; i<layerNode.length; i++) {
            recolor(layerNode[i].layerSets);
            for(var layerIndex=0; layerIndex < layerNode[i].artLayers.length; layerIndex++) {
                var layer=layerNode[i].artLayers[layerIndex];
                if (layer.name == "fillMe") {
                    layer.visible = 1;
                    layer.transparentPixelsLocked = 1;
                    app.activeDocument.activeLayer = layer;
                    var ref = new ActionReference();
                    ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
                    var layerDesc = executeActionGet(ref);
                    if (layerDesc.hasKey(stringIDToTypeID('layerEffects')) == true) {
                        delColOverlay();
                    fillWithNewColor();
                    app.runMenuItem(stringIDToTypeID('selectNoLayers'));
    function fillWithNewColor(){
        var idFl = charIDToTypeID( "Fl  " );
        var desc137 = new ActionDescriptor();
        var idUsng = charIDToTypeID( "Usng" );
        var idFlCn = charIDToTypeID( "FlCn" );
        var idFrgC = charIDToTypeID( "FrgC" );
        desc137.putEnumerated( idUsng, idFlCn, idFrgC );
        executeAction( idFl, desc137, DialogModes.ALL );
    function delColOverlay(){
        var iddsfx = charIDToTypeID( "dsfx" );
        var desc173 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
        var ref77 = new ActionReference();
        var idSoFi = charIDToTypeID( "SoFi" );
        ref77.putClass( idSoFi );
        var idLyr = charIDToTypeID( "Lyr " );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref77.putEnumerated( idLyr, idOrdn, idTrgt );
        desc173.putReference( idnull, ref77 );
        executeAction( iddsfx, desc173, DialogModes.ALL );   
    recolor(app.activeDocument.layerSets);

  • [AS CS5] Get document's default fill color

    Anyone know how to do this?
    What I am trying to do is manually select a color using the color picker, then the script redefines and existing swatch with the same color value.
    I tried:
    set myNewColor to fill color of page item default
    without success...

    I had tried that, but it didn't work either. I think that's because I was using the line in a tell myDocument block, not tell application. It still isn't working, though.
    Here is the script:
    tell application "Adobe InDesign CS5"
         set myDocument to active document
         set myNewColor to fill color of page item defaults
         set mySpace to space of myNewColor
         set myValue to color value of myNewColor
         tell myDocument
              tell color "Color1"
                   set space to mySpace
                   set color value to myValue
              end tell
         end tell
    end tell
    Here is the error:
    error "Adobe InDesign CS5 got an error: Can’t get space of swatch id 3." number -1728 from space of swatch id 3
    The default color is a color sampled from a photo, but the "fill color of page item defaults" is returning a swatch:
    tell application "Adobe InDesign CS5"
    get active document
    --> document id 7
    get fill color of page item defaults
    --> swatch id 3
    get space of swatch id 3
    --> error number -1708

  • Can't apply fills to grouped items

    Just switched to MX from 10. Applying fills or strokes to
    grouped items was very simple in 10 - now when I try to recolour
    groups of objects (or text converted to paths) I'm being
    continually frustrated. I add a fill to a group of objects and they
    don't change colour, so I have to ungroup them to apply the fill.
    Why oh why is it so?

    Nang-a-nator wrote:
    > Double click contents. This
    > will expand to tell you how many objects are in the
    group. if all objects have
    > the same fill and stroke properties this will be
    displayed here.
    This is good advice, but requires one more step. Uncheck
    Preferences>Object>'Changing object changes defaults'.
    For some reason, this
    preference interferes with the display of attributes of
    groups of identical
    objects. This is another FHMX pain if you're used to working
    with this
    preference enabled.
    Here's how I super- and sub-select on a Mac/English keyboard.
    Modify keyboard shortcuts to
    Subselect: F1.
    Superselect: tilde key (`) is already hard-coded into FH.
    These two keys are close together on the keyboard, so
    alternating between
    them allows you to dive down or swim up to group level.
    If, for example, you have a line of text converted to paths,
    with pointer
    too, option-click to subselect one path, then hit Tilde to
    superselect to
    group level, then hit F1 to subselect. You should now see the
    fill and
    stroke attributes in the object inspector. Change them there.
    Judy Arndt

  • Problem applying stroke miter limit with applescript

    Hi, I have a bit of a problem with applescript, Im creating a Text item and setting the stroke to 0.4pt then i want the stroke miter limit to be set to 2 but it wont work i get :-
    Adobe Illustrator got an error: Can’t set properties of text frame 1 of layer 1 of document 1 to {stroke miter limit:2}. (error -10006)
    but im am able to apply a stroke miter limit of 2 on a path item, is there a way of converting the text frame to a path item then applying the stroke miter limit to it.
    heres my script :-
    on TicketFront_(posX, posY)
         tell application "Adobe Illustrator"
              activate
              set ticketItem to make new text frame in theDoc with properties {contents:{"Some Text"}, position:{(35.7 + posX) * 2.834645, (173.5 - posY) * 2.834645}}
              set properties of the text of ticketItem to {text font:text font "Raleway-Thin", size:5.54, justification:center, fill color:{class:spot color info, tint:100.0, spot:spot "PANTONE 4535 U" of document 1}, stroke color:{class:spot color info, tint:100.0, spot:spot "PANTONE 4535 U" of document 1}, horizontal scale:126.46, stroke weight:0.4}
              --This next line gives me the error
              set properties of ticketItem to {stroke miter limit:2}
         end tell
    end TicketFront_
    ive also tryed putting convert to paths ticketItem in the script which converts the text to paths but the stroke miter limit still dont work.
    Thanks in Advance.
    uk_rules_ok

    you're not targeting the paths yet, you have to drill down to the letters (paths)
    textFrame to Outlines returns a Group
    inside this group you have compound paths
    inside each compound path you have the actual paths, one or more, depending on the letter
    try something like this, (not actual code, I'm just guessing)
    set ticketGroup to convert to paths ticketItem
    set ticketCompoundPath to first compoundPath in ticketGroup
    set ticketPath to first pathItem in ticketCompoundPath
    now you can set the miter limit property of ticketPath

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

Maybe you are looking for