• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Find cyan value

Guest
Apr 15, 2014 Apr 15, 2014

Copy link to clipboard

Copied

Hi forum,

I need a great help from you.

There are number of filled items on a page.

And i do want to get Alert,  the value of Cyan inside a swatch.

Any possible to get this.

thanks...forum....

TOPICS
Scripting

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Apr 21, 2014 Apr 21, 2014

HI

try this

var myDoc = app.activeDocument;

var myPage = myDoc.pages;

for (var p=0; myPage.length>p; p++){

    var myItem = myPage

.pageItems.everyItem().getElements();

    for (var i=0; myItem.length>i; i++){

        var cyen = myItem.fillColor;

        if (myItem.fillColor.name!="None"){

        if ((myItem.fillColor.model == ColorModel.SPOT) && (myItem.fillColor.space) )

        alert(myItem.fillColor.name )

        }

    }

}

Mi_D

Votes

Translate

Translate
Contributor ,
Apr 15, 2014 Apr 15, 2014

Copy link to clipboard

Copied

Hi

try this

var myDoc = app.activeDocument;

var myPage = myDoc.pages;

for (var p=0; myPage.length>p; p++){

    var myItem = myPage

.pageItems.everyItem().getElements();

    for (var i=0; myItem.length>i; i++){

        try{

        var cyen = myItem.fillColor;

        alert(cyen.colorValue[0])

            }

        catch(e)

        {e}

        }

    }

Mi_D

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Apr 16, 2014 Apr 16, 2014

Copy link to clipboard

Copied

Hi,

I would think, that the current element should be selected, if the value is displayed and that there is no need to display a value of "0" ?

And: Mi_Ds and my snippet does not find strokes, fill color in table cells and fill color in text at the moment.

var doc = app.activeDocument;

var allPItems = doc.allPageItems;

    for ( var i = 0; i < allPItems.length; i++ ) {

        var curItem = allPItems;

        if ( curItem != "[object Group]" ) {

            if ( curItem.fillColor.name != "None" ) {

                var fColor = curItem.fillColor;

                var cyan = fColor.colorValue[0];

                if ( cyan != 0 ) {

                    curItem.select();

                    alert( "Selected object has a cyan value of: " + cyan );

                } // if

            } // if

        } // if

    } // for

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 16, 2014 Apr 16, 2014

Copy link to clipboard

Copied

Hi

MI_D &&

2. Kai Rübsamen,

Many thanks for the support.

One more support needed to get alert of the coors.

How to find the spot color, with the Color mode as CMYK.

Please see the find attachement for better understanding.Screen Shot 2014-04-16 at 17.52.51.png

Many thanks for the support.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 16, 2014 Apr 16, 2014

Copy link to clipboard

Copied

Hi Unique,

Unique wrote:

… needed to get alert of the coors.

How to find the spot color …

what is a „coors“ ?

If you looking for the color value of your UNIQUE COLOR swatch, you can do something like this:

var aDoc = app.activeDocument;

var aSwatch = aDoc.swatches.itemByName('UNIQUE COLOR');

alert(aSwatch.colorValue);

(Info: Be sure, that a swatch with this name exists.)

Have fun

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 16, 2014 Apr 16, 2014

Copy link to clipboard

Copied

Hi

To find color type color mode like that

var myDoc = app.activeDocument;

var myPage = myDoc.pages;

for (var p=0; myPage.length>p; p++){

    var myItem = myPage

.pageItems.everyItem().getElements();

    for (var i=0; myItem.length>i; i++){

        try{

        var cyen = myItem.fillColor;

        if (myItem.fillColor.model == ColorModel.SPOT && myItem.fillColor.space )

        alert(myItem.fillColor.name )

        }

        catch(e)

        {alert(e)}

        }

    }

Mi_D

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 21, 2014 Apr 21, 2014

Copy link to clipboard

Copied

Hi Mi_D,

Im sorry for the delayed response, since i was in my annual leave.

Mi_D!...thanks for your reply,... & only one clarifications..

when there is any rectangle box filled with  None & stroke applied. or fill or stroke both "None".

the above script show error..

i tried to mention in script like this but no result..

if (myItem.fillColor.model == ColorModel.NONE && myItem.fillColor.space )

any help on this..

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 21, 2014 Apr 21, 2014

Copy link to clipboard

Copied

none.png

please see the above snapshot.....

while running the above script.... it doesnt find the objects with Fill Color NONE & stroke color applied or not....

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 21, 2014 Apr 21, 2014

Copy link to clipboard

Copied

HI

try this

var myDoc = app.activeDocument;

var myPage = myDoc.pages;

for (var p=0; myPage.length>p; p++){

    var myItem = myPage

.pageItems.everyItem().getElements();

    for (var i=0; myItem.length>i; i++){

        var cyen = myItem.fillColor;

        if (myItem.fillColor.name!="None"){

        if ((myItem.fillColor.model == ColorModel.SPOT) && (myItem.fillColor.space) )

        alert(myItem.fillColor.name )

        }

    }

}

Mi_D

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 21, 2014 Apr 21, 2014

Copy link to clipboard

Copied

Thank you so much for your support Mi_D.

I would really like to appreciate the tendency of helping....

I would like to give a point and close the thread...

Would like to post a new question regarding this...

Many thanks Mi_D...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 21, 2014 Apr 21, 2014

Copy link to clipboard

Copied

Thank you so much for your support Mi_D.

I would really like to appreciate the tendency of helping....

I would like to give a point and close the thread...

Would like to post a new question regarding this...

Many thanks Mi_D...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 21, 2014 Apr 21, 2014

Copy link to clipboard

Copied

LATEST

Thank you so much for your support Mi_D.

I would really like to appreciate the tendency of helping....

I would like to give a point and close the thread...

Would like to post a new question regarding this...

Many thanks Mi_D...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines