Illustrator:convert a spot color to its gray scale equivalent

I have all spot colors. I am using a repeat loop to go through each color. I need to convert the spot to its gray scale equivalent. I need to arrange the colors in a list from lightest to darkest. We thought the best way of doing it would be to use the gray scale equivalent because it is only 1 value. If 2 of the colors have the same value we will let the name of the color decide. I tried converting the color to CMYK first and then to Gray scale with no success.
I am converting the spot to CMYK and adding it to the swatch pallet. This part works. Then I use the following command to try and convert it to gray. The variable newGrey is a list. This is in a repeat loop through the swatches. At the end of the loop the new cmyk swatch is removed so it can be used again.

set newGrey to convert sample color {CMYK, "Our CMYK Swatch", Gray, dummy purpose option, false, false}

I get the error:
Adobe Illustrator got an error: Illegal argument - argument 1

  • Required value is missing

    It requires 6 parameters and they are all there. The 4th parameter I have tried all options and it makes no difference.
    I do not believe the command ‘convert sample color’ is for swatch colors but for images. I have gone through the Illustrator documentation and do not see any other way of doing it. I could try to write a sort that would use all 4 cmyk values but that would be a daunting task, or is this my only way around the problem. What do you think?


Model: Macbook Pro , i7 core, 4gb ram
Browser: Firefox 11.0
Operating System: Mac OS X (10.7)

My guess is something like this.

tell application "Adobe Illustrator"
	tell the current document
		set mySpot to the first spot
		set myCMKY to get internal color of mySpot
	end tell
	set myGray to convert sample color source color space CMYK source color myCMKY ¬
		destination color space Gray color conversion purpose default purpose ¬
		without destination has alpha and source has alpha
end tell

Can you explain what is the purpose of what you are doing? Are you recoloring art or wanting to determine an ink sequence for press or.??


Mark 67

The script works great. Thank you very much for your help. The only problem is if I try to use the last spot swatch in the pallet I get this error:

Adobe Illustrator got an error: an Illustrator error occurred: 1346458189 (‘MRAP’)

Do you know what this is?

I have used Java most of the time. When I look at the way I was trying to use ‘convert sample color’ it is the same way you would pass variables to a method in Java. A comma delimited variable list which match what the method requires. I will need to watch that. Applescript is quite different.

Thanks for your help,

Oh Im not sure about that I suppose it depends on your file my last spot is always [Registration] but I edit my start up files and remove all the fluff. :slight_smile:

Thanks Mark
You have me started where I want to be. I appreciate it.


We are determining a Ink sequence.

Thank you,

I juggle using AppleScript & Adobe’s ESTK. and yes things get a little fuzzy from time to time so I know where your coming from. moments of OMG I’ve forgotten.

Kinda figured. Are you wanting to see something in AI or just output to a file?

I just need to output to a file. I have no problem with writing to a file.

Thanks Rich