I just missing something?
The external class are SwatchPalette for performing opertaitons on the runtime palette and ColorSwatches for reading and writing swatch files in various formats.
The array is initialized by first exporting the current swatches to an .aco file, then reading it back in. Is that, again, because you could not find any way of getting an array/list of colours directly out of the palette?
I do not think things have changed since then.
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);// get the app descriptor
var presetsList = desc.getList(stringIDToTypeID('presetManager'));// the presets list
var swatchDesc = presetsList.getObjectValue(1);// swatches is the second key
var nameList = swatchDesc.getList(charIDToTypeID("Nm "));// there is only one key in the swatch descriptor so get the list
var nameOfFirstSwatch = nameList.getString(0);// all the name list keys are strings data types so get the first swatch name
alert( nameOfFirstSwatch );
Users browsing this forum: No registered users and 1 guest