Please note that I'm a complete beginner and this is my first coding question ever. If this is more appropriate on another site, tell me.
I want to automate a process were the program select a colour and change it to another one.
This is the code I have, thank to the script listener:
var id159 = charIDToTypeID( "ClrR" );
var desc34 = new ActionDescriptor();
var id160 = charIDToTypeID( "Fzns" );
desc34.putInteger( id160, 0 );
var id161 = charIDToTypeID( "Mnm " );
var desc35 = new ActionDescriptor();
var id162 = charIDToTypeID( "Rd " );
desc35.putDouble( id162, 0.000000 );
var id163 = charIDToTypeID( "Grn " );
desc35.putDouble( id163, 255.000000 );
var id164 = charIDToTypeID( "Bl " );
desc35.putDouble( id164, 0.000000 );
var id165 = charIDToTypeID( "RGBC" );
desc34.putObject( id161, id165, desc35 );
var id166 = charIDToTypeID( "Mxm " );
var desc36 = new ActionDescriptor();
var id167 = charIDToTypeID( "Rd " );
desc36.putDouble( id167, 0.000000 );
var id168 = charIDToTypeID( "Grn " );
desc36.putDouble( id168, 255.000000 );
var id169 = charIDToTypeID( "Bl " );
desc36.putDouble( id169, 0.000000 );
var id170 = charIDToTypeID( "RGBC" );
desc34.putObject( id166, id170, desc36 ); executeAction( id159, desc34, DialogModes.NO );
When I run this in Photoshop it does work but since I have a lot of colours to select, I want to know
- If there is a more efficient way to do it, using less lines of code. It could be either with the colour range or another tool.
- I would prefer to use hexadecimal values but I have no idea how to write it. I managed to change it to RGB but it was originally using Lab colours.
In this example, the hex would be 00ff00