Make the swatch legend Script

I was wondering if someone could help me edit this text written by John Wundes. Its almost perfect for what I need, but my problem is the text within the sample box when it is returned to the little ones. Ideally, I'd like that it be 90% of the actual sample size. I copied and pasted here if someone could help me I would be very happy. I tried to ask John on his Blog a few times, but I got no response. Also I would like to delete the CMYK values it returns with just the name of PMS only.

Make the legend Swatch v1.1 - CS, CS2, CS3, CS4, CS5

//>=--------------------------------------

//

This script will generate a legend of the rectangles for every nuance in the main Swatches palette.

You can configure the display space and value by configuring the variables at the top

the script.

Update: v1.1 now test the brightness of colors and returns a white label if the color is dark.

//>=--------------------------------------

/ / JS code (c) all rights reserved: John Wundes ( [email protected] ) www.wundes.com

/ / copyright full text here: http://www.Wundes.com/js4ai/copyright.txt

//

//////////////////////////////////////////////////////////////////

doc = activeDocument,

color chart = doc.swatches,

cols = 10,

displayAs = "CMYKColor" //or "RGBColor".

rectRef = null,

textRectRef = null,

textRef = null,

rgbColor = null,

w = 150;

h = 150,

h_pad = 100,

v_pad = 100,

t_h_pad = 100,

t_v_pad = 100,

x = null,

y = null,

Black = new GrayColor();

White = new GrayColor()

;

Etc = 100;

White.Gray = 0;

activeDocument.layers [0] .locked = false;

newGroup var = doc.groupItems.add ();

newGroup.name = "NewGroup";

newGroup.move (doc, ElementPlacement.PLACEATBEGINNING);

for (var c = 2, len = swatches.length; c < len; c ++)

{

swatchGroup var = doc.groupItems.add ();

swatchGroup.name = color chart [c] .name;

x = (w + h_pad) * (c % COL);

y=(h+v_pad)*(math.floor((c+.01)/cols)) *-1;

rectRef = doc.pathItems.rectangle (y, x, w, h);

rgbColor = .color swatches [c];

rectRef.fillColor = rgbColor;

textRectRef = doc.pathItems.rectangle (t_v_pad-y, x + t_h_pad, w.-(2*t_h_pad), h.-(2*t_v_pad));

textRef = doc.textFrames.areaText (textRectRef);

textRef.contents = color chart [c] .name + "\r" + getColorValues (swatches [c] .color);

textRef.textRange.fillColor = is_dark (swatches [c] .color)? White: black;

//

rectRef.move (swatchGroup, ElementPlacement.PLACEATBEGINNING);

textRef.move (swatchGroup, ElementPlacement.PLACEATBEGINNING);

swatchGroup.move (newGroup, ElementPlacement.PLACEATEND);

}

function getColorValues (color)

{

If (Color.TypeName)

{

Switch (Color.TypeName)

{

case "CMYKColor":

If (displayAs == "CMYKColor") {}

return ([Math.floor (color.cyan) Math.floor (color.magenta), Math.floor (color.yellow), Math.floor (co lor.black)]) ;}

on the other

{

Color.TypeName = "RGBColor";

return [Math.floor (color.red), Math.floor (color.green), Math.floor (color.blue)];

}

case "RGBColor":

If (displayAs == "CMYKColor") {}

Return rgb2cmyk (Math.floor (color.red), Math.floor (color.green), Math.floor (color.blue));

} else

{

return [Math.floor (color.red), Math.floor (color.green), Math.floor (color.blue)];

}

case "GrayColor":

If (displayAs == "CMYKColor") {}

Return rgb2cmyk (Math.floor (color.gray), Math.floor (color.gray), Math.floor (color.gray));

} else {}

return [Math.floor (color.gray), Math.floor (color.gray), Math.floor (color.gray)];

}

case "SpotColor":

Return getColorValues (color.spot.color);

}

}

return 'no Standard color Type';

}

function rgb2cmyk (r, g, b) {}

var computedC = 0;

var computedM = 0;

var computedY = 0;

var computedK = 0;

remove the spaces of input RGB values, convert to int

var r = parseInt (('' + r) replace (/ \s/g, "), 10);

var g = parseInt (('' + g) replace (/ \s/g, "), 10);

var b = parseInt (('' + b) replace (/ \s/g, "), 10);

If (r == null | g == null | b == null |)

isNaN (r) | isNaN (g) | isNaN (b))

{

Alert ("Please enter the numeric RGB values!");

return;

}

If (r < 0 | g < 0: b < 0 | r > 255 | g > 255: b > 255) {}

Alert ("the RGB values must be in the range 0 to 255");

return;

}

BLACK

If (r == 0 & & g == 0 & & b == 0) {}

computedK = 1;

return [0,0,0,1];

}

computedC = 1 - (r/255);

computedM = 1 - (g/255);

computedY = 1 - (b/255);

var minCMY = Math.min (computedC,

Math.min (computedM, computedY));

computedC = (computedC - minCMY) / (1 - minCMY);

computedM = (computedM - minCMY) / (1 - minCMY);

computedY = (computedY - minCMY) / (1 - minCMY);

computedK = minCMY;

return [Math.floor(computedC*100), Math.floor(computedM*100), Math.floor(computedY*100), Math.floor (computedK * 100)];

}

function is_dark (color) {}

If (Color.TypeName)

{

Switch (Color.TypeName)

{

case "CMYKColor":

return (> 50 color.black |) (color.cyan > 50 & & color.magenta > 50)) ? true: false;

case "RGBColor":

return (color.red < 100 & & color.green < 100)? true: false;

case "GrayColor":

return color.gray > 50? true: false;

case "SpotColor":

Return is_dark (color.spot.color);

Returns false;

}

}

}

Natesroom1 wrote:

1. the text is small

2 remove the CMYK values it returns with just the name of PMS only

Just a quick look at the code, try the following:

1.) for the size, after this line:

textRef = doc.textFrames.areaText(textRectRef);

Add the following line, the numerical value on any size suits you:

textRef.textRange.characterAttributes.size = 20;

(2.) about removing the CMYK values for PMS colors, change this line:

textRef.contents = swatches[c].name+ "\r" + getColorValues(swatches[c].color);

To do this:

textRef.contents = swatches[c].name;

Once again... just a little wink, but maybe it will help your efforts.

Tags: Illustrator

Similar Questions

  • Unable to make the JAVA LEGEND

    Hi all

    I work in a project where I need to read an image through OSB panels, tends in a shared path and the base64code of this image to return to the client. To do this, I wrote

    a java class. It works very well. This java class has a method that accepts 2 parameters one is the name of the image and the other is updated the day, based on which we need to send the

    Base64 this image. I'm able to return that when I run the java class. When I use the same class in the OSB and make a legend of java I do not get the response I get when

    I have run the java class only. Instead, I get 'no response there is' something like that. What could be the reason. Kindly help me.

    Thank you

    did not work for me - returned "[B@67386000".

    you could try my sample, like this:

         public static String image() throws IOException {
    
              BufferedImage image = ImageIO.read(new File(
                        "some.jpg"));
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              ImageIO.write(image, "jpg", baos);
              String encodedImage = new sun.misc.BASE64Encoder().encode(baos.toByteArray());
    
              return encodedImage;
    
         }
    
  • Script to make the list of layer names.

    I wonder if someone could help me make the simple script that take the layer names and the list of their share on the A4 in canvas.

    Now I just got the screenshot of the list of Illustrator and edit it through photoshop to print, but it is too small, because each file have a approximately 25-50 layers.

    Looks like this:

    layer-list.jpg

    I tried to edit the script of John Wundes, which makes the list of the nuances, but it seems difficult for my skills.

    /////////////////////////////////////////////////////////////////
    // Render Swatch Legend v1.1 -- CS, CS2, CS3, CS4, CS5
    //>=--------------------------------------
    //
    //  This script will generate a legend of rectangles for every swatch in the main swatches palette.
    //  You can configure spacing and value display by configuring the variables at the top
    //  of the script. 
    //   update: v1.1 now tests color brightness and renders a white label if the color is dark.
    //>=--------------------------------------
    // JS code (c) copyright: John Wundes ( [email protected] ) www.wundes.com
    // copyright full text here:  http://www.wundes.com/js4ai/copyright.txt
    //
    ////////////////////////////////////////////////////////////////// 
        doc = activeDocument,
        swatches = doc.swatches,
        cols = 4,
        displayAs = "CMYKColor",  //or "RGBColor"
        rectRef=null,
        textRectRef=null,
        textRef=null,
        rgbColor=null,
        w=150;
        h=100,
        h_pad = 10,
        v_pad = 10,
        t_h_pad = 10,
        t_v_pad = 10,
        x=null,
        y=null,
        black = new GrayColor(),
        white = new GrayColor()
        ;
    
    
        black.gray = 100;
        white.gray = 0;
    
    
    activeDocument.layers[0].locked= false;
    var newGroup = doc.groupItems.add();
    newGroup.name = "NewGroup";
    newGroup.move( doc, ElementPlacement.PLACEATBEGINNING );
    
    
    for(var c=0,len=swatches.length;c<len;c++)
    {
            var swatchGroup = doc.groupItems.add();
            swatchGroup.name = swatches[c].name;
           
            x= (w+h_pad)*(c% cols);
            y=(h+v_pad)*(Math.floor((c+.01)/cols))*-1 ;
            rectRef = doc.pathItems.rectangle(y,x, w,h);
            rgbColor = swatches[c].color;
            rectRef.fillColor = rgbColor;
            textRectRef =  doc.pathItems.rectangle(y- t_v_pad,x+ t_h_pad, w-(2*t_h_pad),h-(2*t_v_pad));
            textRef = doc.textFrames.areaText(textRectRef);
            textRef.contents = swatches[c].name+ "\r" + getColorValues(swatches[c].color) ;
            textRef.textRange.fillColor = is_dark(swatches[c].color)? white : black;
            //
            rectRef.move( swatchGroup, ElementPlacement.PLACEATBEGINNING );     
            textRef.move( swatchGroup, ElementPlacement.PLACEATBEGINNING );
            swatchGroup.move( newGroup, ElementPlacement.PLACEATEND );
    }
    
    
    function getColorValues(color)
    {
            if(color.typename)
            {
                switch(color.typename)
                {
                    case "CMYKColor":
                        if(displayAs == "CMYKColor"){
                            return ([Math.floor(color.cyan),Math.floor(color.magenta),Math.floor(color.yellow),Math.floor(color.black)]);}
                        else
                        {
                            color.typename="RGBColor";
                            return  [Math.floor(color.red),Math.floor(color.green),Math.floor(color.blue)] ;
                           
                        }
                    case "RGBColor":
                       
                       if(displayAs == "CMYKColor"){
                            return rgb2cmyk(Math.floor(color.red),Math.floor(color.green),Math.floor(color.blue));
                       }else
                        {
                            return  [Math.floor(color.red),Math.floor(color.green),Math.floor(color.blue)] ;
                        }
                    case "GrayColor":
                        if(displayAs == "CMYKColor"){
                            return rgb2cmyk(Math.floor(color.gray),Math.floor(color.gray),Math.floor(color.gray));
                        }else{
                            return [Math.floor(color.gray),Math.floor(color.gray),Math.floor(color.gray)];
                        }
                    case "SpotColor":
                        return getColorValues(color.spot.color);
                }    
            }
        return "Non Standard Color Type";
    }
    function rgb2cmyk (r,g,b) {
     var computedC = 0;
     var computedM = 0;
     var computedY = 0;
     var computedK = 0;
    
    
     //remove spaces from input RGB values, convert to int
     var r = parseInt( (''+r).replace(/\s/g,''),10 ); 
     var g = parseInt( (''+g).replace(/\s/g,''),10 ); 
     var b = parseInt( (''+b).replace(/\s/g,''),10 ); 
    
    
     if ( r==null || g==null || b==null ||
         isNaN(r) || isNaN(g)|| isNaN(b) )
     {
       alert ('Please enter numeric RGB values!');
       return;
     }
     if (r<0 || g<0 || b<0 || r>255 || g>255 || b>255) {
       alert ('RGB values must be in the range 0 to 255.');
       return;
     }
    
    
     // BLACK
     if (r==0 && g==0 && b==0) {
      computedK = 1;
      return [0,0,0,1];
     }
    
    
     computedC = 1 - (r/255);
     computedM = 1 - (g/255);
     computedY = 1 - (b/255);
    
    
     var minCMY = Math.min(computedC,
                  Math.min(computedM,computedY));
     computedC = (computedC - minCMY) / (1 - minCMY) ;
     computedM = (computedM - minCMY) / (1 - minCMY) ;
     computedY = (computedY - minCMY) / (1 - minCMY) ;
     computedK = minCMY;
    
    
     return [Math.floor(computedC*100),Math.floor(computedM*100),Math.floor(computedY*100),Math.floor(computedK*100)];
    }
    
    
    function is_dark(color){
           if(color.typename)
            {
                switch(color.typename)
                {
                    case "CMYKColor":
                        return (color.black>50 || (color.cyan>50 &&  color.magenta>50)) ? true : false;
                    case "RGBColor":
                        return (color.red<100  && color.green<100 ) ? true : false;
                    case "GrayColor":
                        return color.gray > 50 ? true : false;
                    case "SpotColor":
                        return is_dark(color.spot.color);
                    
                    return false;
                }
            }
    }
    

    arop16461101,

    something like that?

    var theLayers = app.activeDocument.layers;
    var str = new Array ();
    for (i = 0; i < theLayers.length; i++) {
        str.push (theLayers[i].name)
        }
    var tF = theLayers[0].textFrames.add();
    tF.contents = str.join ("\r");
    alert("new text frame with layerlist added on layer " + theLayers[0].name);
    

    Have fun

  • How to make the calculation script to show 2 decimal places and stop rounding down to integers?

    Hello. First of all, thank you to those of you who have helped me create an interactive PDF file last year that worked perfectly if only integers are entered. This year, my client wants to show two decimal places in the calculations, and I'm back in this forum hoping to find the same expertise to make it happen.

    My form includes 43 fields for various monthly expenses. The sign of dollar for each field is part of the content of the form, not part of the scope of formatting. Users enter values directly in these fields, and the fields are formatted to display two decimal places. Each of these includes a the following validation script:

    Event.RC =! (event.value & & + event.value < 0);


    To the right of each of these fees, the fields are yes/no boxes ( expense Typecalled) that answer the question, "is this essential expense? The value of exports for Yes's 'essential', and the value of exports is "discretionary".


    A value entered in all areas of expenditure is directed to the field Total expenses by checking Yes or field Total discretionary spending by clicking No. two of these total fields are formatted to display two decimal places. In addition to long calculation scripts, the two totals fields include this custom validation script:

    If (event.value == "0") {event.value = util.printx ("", event.value)}

    Here's the problem: when values with two decimal places are entered in any area of expenditure, the calculation in two fields of total script rounded to the whole number closest. When 10.99 is entered in a field of expenditure and the Yes checkbox is checked, the value 10.00 is displayed in the field Total expenses . I want to display 10.99.

    For testing purposes, I inserted a new text field and did a simple calculation in choosing the fields of the somme and the values displayed correctly. The problem is definitely with the script in the two fields in total .


    I can drop the scripts of math here, but they are long and I'm not sure what the Protocol is super-long positions. I could also download the file, but I never did it and will need to understand this.

    Thank you for taking the time to read this. If you can help me, very well!

    To explicitly convert the field values for numbers, do something like this instead:

    var expense0 = + getField('monthly$.0').value,

    depenses1 = + getField('monthly$.1').value,

    etc.

  • Make the script shell on command 'srvctn '.

    Hi all

    Hello.

    I want to make the Shell Script on srvctn command,
    research work is not state of the node.
    I'm using the 11g environment.

    For example by using the command "srvctl start database-d."
    showing as follows.


    *******************************************
    example of order <>

    $ srvctl status database-d RAC
    RAC1 instance is not running on the node collabn1
    RAC2 instance is running on the node collabn2
    *******************************************


    As described below, I want to exit
    the is not running on the node list.

    *******************************************
    example of <>output

    collabn1
    collabn3
    collabn5
    *******************************************

    Could you please tell any person or to the statement above, out of shell script?

    I'm grad to send the response.

    Thank you and best regards.

    Hello

    you could do something like the following:

    #!/bin/sh
    
    srvctl status database -d RAC | grep 'not running' | sed -e 's/^.* node //'
    

    and this will give output like that in your example.

    Since you could easily expand your script to actually pronounce on the nodes does not.

    HtH
    Johan

    Published by: Johan Nilsson on December 20, 2011 02:57

  • How to disable the "Swatch overprint [Black] to 100%" option in Indesign by Apple script

    Hi friends,

    I'm new to Indesign Scripting with Apple Script. As a beginner, I'm doing some basic scripting in Indesign by Apple Script.

    My goal is to turn off the "Swatch overprint [Black] to 100%" option in Indesign. This option is available when we go to Indesign-> Preferences-> appearance of black.

    In addition, if a user opens a file, in which the sample is already activated, then he should encourage him to turn off.

    I can do a display dialog box in AppleScript. But I am little unsure as how can I go ahead and disable this option. I tried this script below:

    say application «Adobe InDesign CS4»

    say each window layout to the value the overprint preview to fake

    end say

    However, it changes the display of the overprint preview option.

    Appreciate your help and suggestions!

    Thank you

    Abhishek

    say application "Adobe InDesign CS5.

    say the active document

    set overprint black of the document preferences to false

    end say

    end say

  • How to make the new Swatch palette from scratch

    is it possible to create a new Swatch Panel from scratch and add only to the colors I put - if yes, how could I do

    Remove the existing colors in the Swatches palette, or the preset manager.

  • How to make the line break in the Validation Script Message

    Hello

    Declaration of im trying to write a multi-line error message in the Validation Script Message to a textfield, but every time that I hit, I find myself at the front of the current line instead of a new line.  I also tried \n with no luck.  The only way I have found is by entering the text in Notepad, then cut + paste into the Message of Script of Validation box.  Is this a bug with the Designer?  I have Designer ES 8.2.1.3158.1.475346.

    ValScriptMesgEd.JPG

    I know how to do scripted ex.  this.validationMessage = "line1\nline2" but what I want is store Section and the field name in the Script of selection Message box and then generate the error message ontop via the script.

    ex.

    this.validationMessage = this.validationMessage + ' Validation has no reason of...» » ;

    Just tested this and it looks like ctrl - enter in the works.

  • Cannot change the fill via script UI button color?

    I have simple scriptUI where is the button that calls the simple function. Function work correctly if I normally call out of button, but when I try to change color after clicking the button, nothing happened.

    I tried to change the average RGB simple and now I tested this CMYK version which is Forum. Nothing seems to work through this button. Function runs, but does not affect the colors. Am I missing something on scriptUIs...

    Please, anyone know where is the problem?

    #target illustrator
    
    
    //changeColor();
    
    
    function changeColor() {
    
    
        var docRef = app.activeDocument;
        var  col;
         
        var col = new CMYKColor();
        col.cyan = 2;
        col.magenta = 3;
        col.yellow = 15;
        col.black = 0;
         
        // Create the new swatch using the above color
        var swatch = docRef.swatches.add();
        swatch.color = col;
        swatch.name = "col";
         
        // Apply the swatch to a new path item
        var pathRef = docRef.pathItems[0];
        pathRef.filled = true;
        pathRef.fillColor = swatch.color;
    
    
    }
    
    
    createGUI ();
    
    
    function createGUI() {
        var win = new Window("palette", "Test", [150, 150, 460, 455]); // bounds = [left, top, right, bottom]  
        windowRef = win; 
        
        win.increaseColorBtn = win.add("button", [110,50,200,150], "Change");
        
        win.increaseColorBtn.onClick = function () {
            changeColor ();        
        };  
    
    
        // Create quit button and trigger for it
        win.quitBtn = win.add("button", [110,275,200,295], "Close"); 
        win.quitBtn.onClick = function() {   
            win.close();   
        } 
    
    
        win.show();  
    }
    

    Sorry, but you will need to use the BridgeTalk object when working with pallets.  How to make your script work is to do the type of window 'dialogue' and put redraw(); in your changeColor(); function to see instantaneous changes.  But you can access the rest of the user of AI interface due to the dialog box modal.

  • Coloring a font with a RGB, etc. without adding color in the swatch of the document.

    Is it possible to color a font with a RGB, Lab, or CMYK color without adding color in the swatch of the document.

    The only way I know is to add a color to the color chart or use an existing one.

    as

    App.Selection [0]. Characters [0]. FillColor = document. Colors.Add ({colorValue: 255, 53 (160) and space: ColorSpace.RGB}) ;}

    As a side effect to clutter up shades using many colors.

    any ideas?

    Hello Uwe!

    After 03:00 by me 02:00 by you

    I tried the link and it download but I have cs5 cs6 and cc but not cs5.5 and all the scripts worked on them can due to the conversion of files.

    It seems therefore that the following summary is all is correct

    New documents contain some

    Color chart (black, registration, paper and none) the index order is the order in which shades appear in the swatches Panel

    And the colors in the order of the alphabetical index

    named colors without name last and then 'A', 'Z' first color.

    Color documents News-[1] will be a color without a name that can be duplicated to produce other colors without name, noting that duplication should be processes and not the tones.

    So far so good, (not for long)

    Unnamed colors are not read only so if we make a positive effort to remove, we can do that.

    while (app.activeDocument.colors[-1].name == "") app.activeDocument.colors[-1].remove()
    

    Now, we will not have any what swatches without a name to duplicate and will have to use the method of file text marked with John at number 3 above.

    If there is no shade no name and we try to replicate the colors [-1] and it's a color as 'Yellow', then it seems s indesign crash.

    In any case the method below should always work (for regular non-dyed colours etc.).

    // optimized for easy of use but not efficiency !!!
    var doc = app.documents.add();
    var p = doc.pages[0];
    
    p.textFrames.add({contents: "RGB", geometricBounds: ["0mm", "0mm", "30mm", "30mm"], fillColor: addUnnamedColor([0, 0,255])}); // will be a RGB
    p.textFrames.add({contents: "RGB", geometricBounds: ["0mm", "30mm", "30mm", "60mm"], fillColor: addUnnamedColor([0, 255,0], 1666336578)}); // will be a RGB because of value
    p.textFrames.add({contents: "RGB", geometricBounds: ["0mm", "60mm", "30mm", "90mm"], fillColor: addUnnamedColor([65, 50, 102], ColorSpace.RGB)}); // will be a RGB
    p.textFrames.add({contents: "RGB", geometricBounds: ["0mm", "90mm", "30mm", "120mm"], fillColor: addUnnamedColor([84, 90,40],"r")}); // will be a RGB
    p.textFrames.add({contents: "RGB", geometricBounds: ["0mm", "120mm", "30mm", "150mm"], fillColor: addUnnamedColor([232, 0, 128],1)}); // will be a RGB
    
    p.textFrames.add({contents: "Lab", geometricBounds: ["30mm", "0mm", "60mm", "30mm"], fillColor: addUnnamedColor([29.5, 67.5, -112])}); // will be a Lab because of -
    p.textFrames.add({contents: "Lab", geometricBounds: ["30mm", "30mm", "60mm", "60mm"], fillColor: addUnnamedColor([100, -128, 127], 1665941826)}); // will be a Lab because of value
    p.textFrames.add({contents: "Lab", geometricBounds: ["30mm", "60mm", "60mm", "90mm"], fillColor: addUnnamedColor([24.5, 16, -29], ColorSpace.LAB)}); // will be a Lab
    p.textFrames.add({contents: "Lab", geometricBounds: ["30mm", "90mm", "60mm", "120mm"], fillColor: addUnnamedColor([36.8, -9, 27],"l")}); // will be a Lab
    p.textFrames.add({contents: "Lab", geometricBounds: ["30mm", "120mm", "60mm", "150mm"], fillColor: addUnnamedColor([51, 78, 0], -1)}); // will be a Lab because of the 1
    
    p.textFrames.add({contents: "CMYK", geometricBounds: ["60mm", "0mm", "90mm", "30mm"], fillColor: addUnnamedColor([82, 72, 0, 0])}); // will be a CMYK because there are 4 color values
    p.textFrames.add({contents: "CMYK", geometricBounds: ["60mm", "30mm", "90mm", "60mm"], fillColor: addUnnamedColor([60, 0, 100, 0], 1129142603)}); // will be a CMYK because of value
    p.textFrames.add({contents: "CMYK", geometricBounds: ["60mm", "60mm", "90mm", "90mm"], fillColor: addUnnamedColor([84, 90,40, 0], ColorSpace.CMYK)}); // will be a CMYK
    p.textFrames.add({contents: "CMYK", geometricBounds: ["60mm", "90mm", "90mm", "120mm"], fillColor: addUnnamedColor([67, 53, 97.6, 21.7], "c")}); // will be a CMYK
    p.textFrames.add({contents: "CMYK", geometricBounds: ["60mm", "120mm", "90mm", "150mm"], fillColor: addUnnamedColor([0, 100, 0, 0], 0)}); // will be a CMYK
    
    function addUnnamedColor (cValue, space, docToAddColor) {
        docToAddColor = app.documents.length && (docToAddColor || (app.properties.activeDocument && app.activeDocument) || app.documents[0]);
        if (!docToAddColor) return;
        var lastColor = docToAddColor.colors[-1];
        if (!cValue) cValue = [0,0,0,0];
        if (space == 1129142603 || cValue && cValue.length == 4) space = ColorSpace.CMYK;
        else if ((space && space < 0) ||  space && space == 1665941826 || (space && /L|-/i.test(space.toString())) || (cValue && /-/.test(cValue ))) space = ColorSpace.LAB;
        else if ((space && space > 0) || space && space == 1666336578 || (space && /R/i.test(space.toString())) || (cValue && cValue.length == 3)) space = ColorSpace.RGB;
        else space = ColorSpace.CMYK;
        app.doScript (
            """
            var newUnnamedColor = (lastColor.name == "") ? lastColor.duplicate() : taggedColor();
            newUnnamedColor.properties = {space: space, colorValue: cValue};
            """,
            ScriptLanguage.javascript,
            undefined,
            UndoModes.FAST_ENTIRE_SCRIPT
        );
    
         function taggedColor() { // need to use this if no unnamed exists
                 var tagString = "\r " : "WIN>\r ") + ""; // would make more sense to apply the correct value in the tagged text file but I can't be bothered !
                 var tempFile = new File (Folder (Folder.temp) + "/ " + (new Date).getTime() + ".txt");
                 tempFile.open('w');
                 tempFile.write(tagString);
                 tempFile.close();
                 var tempFrame = docToAddColor.pages[-1].textFrames.add();
                 $.sleep(250);
                 tempFrame.place(tempFile);
                 tempFrame.remove();
                 tempFile.remove();
    
             return docToAddColor.colors[-1];
    
         }
    
        return newUnnamedColor;
    }
    

    Apply the function to remove and replace swatch on the other thread both healthier of mind

    Concerning

    Trevor

  • Web links open in a new tab or a new window, how to make the web link open in my current tab?

    I could find ways to do the reverse of this and make the links to open in new tabs, but none that answered this question

    It is difficult because the links in a page can work in several ways:

    • no attribute "target" - open in the same tab
    • the value of attribute 'target ':

      • "_blank" - open in a new tab
      • 'name1' (used before and currently open)-replace the page on the tab 'name1 '.
      • 'name2' (not used before or already closed) - open in a new tab
    • script attached to the link to override her normal behavior - a variety of outcomes are possible, including a whole new window

    You can try the settings of parameters in this old thread: https://support.mozilla.org/questions/985943

    Who do you want?

  • How can I make the tΓches play a mp3 file at some point please?

    I would like to that task scheduler to open windows media player and play an MP3 for me at a given time. I followed the instructions here, but nothing helps. The windows media player window does not open, but it does not play mp3.

    http://www.Vistax64.com/tutorials/132903-Task-Scheduler-create-task.html

    In the program/script box, I put in "C:\Program Files\Windows Media Player\wmplayer.exe '.

    In the Add arguments box, I put in: Wildlife.mp3

    At the beginning of area (optional), I put in: C:\Reminders

    which is a folder that I created in the C drive.

    Wildlife.MP3 file is of course in the C\Reminders folder.

    I have Windows 7.

    How can I make the tΓches play a mp3 file at some point please?

    In the arguments to the full path of the file in quotes, "c:\reminders\wildlife.mp3."

    http://Windows.Microsoft.com/en-us/Windows7/schedule-a-task

  • Can I make the streaming Radio app using webworks?

    Hello... I am new to the web and webworks actually...

    but I have training in html, css and java script...

    I want to develop the radio online streaming app...

    is it possible if I using webworks instead of java?

    cause I do not have any background with java prog...

    thnk you...

    thnk you... is it so webworks also compatible with smartphone blackberry (OS 7, 5 or 6) in order to make the radio online streaming?

  • Extract the Variables from Script Powershell

    Hey guys

    I am building a workflow active directory of this synchronization for the IAC database and I'm looking to make the most effective possible by reducing the amount of powershell scripts I use one only and then use the variables powershell to get what I need.

    Is it possible to extract the variables stored in a variable of workflow instead of use the output of the powershell statement?

    Has anyone built a workflow to users of this synchronization of DB works maximum efficiency on the when modified date now that mine is 28 minutes to synchronize 200 users.

    Matt

    From a design point of view, I would say to use the generic OLEDB data adapter.  There is an OleDB for Active Directory Provider called ADsDSOObject. You can find it by searching on the Microsoft site.  It can be installed as part of the standard Windows or .net.  I'm not sure. If you could get it saved on the server of PO, you would be able to do a select and use the output as native table instead of the Powershell output analysis.

    PowerShell has a tendency to be underperforming.  Certainly, I'd caution against the appellant PowerShell repeatedly in a loop.

  • Configuration in the event handler scripts

    Hi guys,.

    This is my first question here.

    Please forgive me if I have some grammar errors.

    I'm building a plugin for Photoshop CC which includes several scripts jsx and a Panel of the HTML of the CEP.

    In my plugin I would activate a script jsx on all the actions that the user is within the app.

    I managed to achieve using the Script event handler and parameters of my script to run the event "Everything" (see image below).

    My question is if anyone knows how I can configure my jsx script in the handler automatically during the installation of my plugin.

    I'm not talking about copy the script in the destination folder (settings presets/scripts /).

    The flow I'm looking for is as follows:

    1. The user install my plugin from https://creative.adobe.com/addons
    2. Activate user the plugin by going to Windows-> Extensions-> MyPluginName
    3. When loading my CEP Panel, he calls a script jsx (which is included in the plugin).
    4. The jsx (from the 3rd stage) script sets another jsx script (which is also included in the plugin) to operate on all the actions that the user makes the Photoshop app.

    I need an automatic solution to the fourth step. Anyone...?

    Capture.JPG

    P.s

    I am familiar with the events Manager.xml Script file, but the addition of my script to the list is a partial solution.

    I am looking for a fully automatic solution in the background.

    app.notifiersEnabled = true;
    app.notifiers.add( "All ",new File('path/to/your.jsx') );
    

Maybe you are looking for