Changing spot colors with different swatch names in Illustrator

I have hundreds of Illustrator files where I need to change the spot color from 30% magenta to white. The problem is the swatch names are different in each of the files but the magenta is always 30%. Does anyone know how to select a swatch that has 30% magenta in it regardless of the swatch name and change it to white?

Hi. Do you want to change the swatch or the items colored by the swatch (or both)?
If the former, then something like this:

tell application "Adobe Illustrator"'s document 1 to ¬
	set (spots whose color is {class:CMYK color info, cyan:0.0, magenta:30, yellow:0.0, black:0.0})'s color to {class:CMYK color info, cyan:0.0, magenta:0, yellow:0.0, black:0.0}

I recently posted a script about a merge, which you could modify to do the latter”just search the forum.

I want to change the swatch and all the items in the document so in the end the swatch would be changed to white and all areas in the document would also update to reflect the new color.

Thanks for your help as I am not an Applescripter. It works perfect!! I just added in to check for the swatch first.
tell application “Adobe Illustrator”
tell document 1
if exists (spots whose color is {class:CMYK color info, cyan:0.0, magenta:30, yellow:0.0, black:0.0}) then
set (spots whose color is {class:CMYK color info, cyan:0.0, magenta:30, yellow:0.0, black:0.0})'s color to {class:CMYK color info, cyan:0.0, magenta:0, yellow:0.0, black:0.0}

	end if
end tell

end tell

Marc,
Do you know if this should work with decimals? In my example I have cyan set to 3.1. In my swatch I have cyan set to 3.1%. It works great as long as the colors are set to a whole number. When I add in a decimal point it doesn’t error but it doesn’t change the color. Thanks for all your help.

tell application "Adobe Illustrator"
	tell document 1
		if exists (spots whose color is {class:CMYK color info, cyan:3.1, magenta:60, yellow:7, black:0}) then
			set (spots whose color is {class:CMYK color info, cyan:3.1, magenta:60, yellow:7, black:0})'s color to {class:CMYK color info, cyan:0.0, magenta:0.0, yellow:0.0, black:0.0}
		end if
	end tell
end tell

You shouldn’t use decimals in this arrangement. If the document swatch is set to 3.1, you search for 3 in-code, and it gets captured by rounding. If the swatch is set to 3.6, then you’d search for 4. Alternatively, you could iterate through each color value searching for a range.

Marc, that worked perfect as you stated. The only issue I see is when there is a gradient path item it errors. Thanks for all of your help with this.