Simple -- you ask someone :-)
for (c=0; c<app.activeDocument.colors.length; c++) if (app.activeDocument.colors[c].model == ColorModel.SPOT) app.activeDocument.colors[c].model = ColorModel.PROCESS;
Usually I would go for
app.activeDocument.colors.everyItem().model = ColorModel.PROCESS;
but it seems not every color has a model (??) or can be converted to Process (perhaps the built-ins Black,Paper, etc. mess things up).
Awesome, thanks Jongware. I was way off.
I'm in the learning stage of writing JS. How do you know when to use "colors" instead of "swatches" or even "inks"?
Thanks again Jongware, that makes my day...
InDesign doesn't work with 'colors' by default; if you use a spot or process color, it gets added to the Swatch panel. Now, one way to reliably iterate over all swatch items is using 'everyItem' -- a very handy function, which I'm using more and more instead of looping over an object array. It's description is not that useful ("Returns every Xxx in the collection" -- how? what do you get?) so, usually I just try.
It didn't work because the spot/process property is just found in "Color" (under the name "model") -- not in Swatches and Inks. At first I tried to sneak around this, using a try..catch (so InDesign picks up the error and continues on the next line) and then with 'hasOwnProperty('model'). Fortunately, you can loop over just the colors.
It's just a matter of trying the first thing you come up with and reading the unavoidable error message very carefully :-)