Copy link to clipboard
Copied
When document is set to 'Image > Mode > Indexed Color' we can choose 'Image > Mode > Table Color'. Then we can manually load / save current settings.
To load saved Color Table via scripting we can use this code (which works):
fle = File('~/desktop/ColorTable.act')
sTT = stringIDToTypeID; (dsc = new ActionDescriptor());
(ref = new ActionReference()).putProperty(sTT('color'), sTT('colorTable'));
dsc.putReference(sTT('null'), ref), dsc.putPath(sTT('to'), fle);
executeAction(sTT('set'), dsc, DialogModes.NO)
To export Color Table via scripting we are supposed to use this code (which doesn't work):
sTT = stringIDToTypeID; (dsc = new ActionDescriptor())
.putPath(sTT('null'), File('~/desktop/ColorTable.act'));
(ref = new ActionReference()).putProperty(sTT('color'), sTT('colorTable'));
dsc.putReference(sTT('to'), ref), executeAction(sTT('set'), dsc, DialogModes.NO)
It results as "Error: General Photoshop error occurred. This functionality may not be available in this version of Photoshop. - The parameters for command "Set" are not currently valid.", but probably Tom Ruark may confirm the code is correct so it's a bug...
I tried it in Photoshop 23.3.1 but the same is in previous releases: