• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Saving Color Table via ExtendScript ends with error.

LEGEND ,
May 03, 2022 May 03, 2022

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:

How do I export the color table (.act file) using a script?

TOPICS
Actions and scripting , Windows

Views

300

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
May 04, 2022 May 04, 2022

Copy link to clipboard

Copied

I don't see any code inside of Photoshop to allow saving of the color table via a script. Sorry for the inconvenience.  

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 04, 2022 May 04, 2022

Copy link to clipboard

Copied

LATEST

Any chance we can have it like for Patterns? This code is constructed differently, but it exports:

 

sTT = stringIDToTypeID, fle = File('~/desktop/pat.pat')
ref = new ActionReference(), (dsc = new ActionDescriptor())
.putPath(sTT('null'), fle); ref.putIndex(sTT('pattern'), 1);
(lst = new ActionList()).putReference(ref), dsc.putList(sTT('to'), lst)
executeAction(sTT('set'), dsc)

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines