Quantcast
Channel: Adobe Community: Message List - Photoshop Scripting
Viewing all articles
Browse latest Browse all 27456

Return Individual Values From Array as Variables

$
0
0

Is it possible to loop through the channels and return their individual RGB values and names so they can be assigned to a var to be used later in the script as well as to build and populate a scriptUI?

 

I think I specifically need the RGB values so I can color the panels to represent the colors associated with each channel as the scriptUI .graphics.newBrush method only seems to accept RGB.  I could be completely wrong about that though as my scripting knowledge is limited.

 

I need the name so I can make the channel active using getByName.  Not yet comfortable with targeting by index and think it would be much simpler to catch the name instead in this case

 

Essentially, I'd love for the loop to return something like:

 

for(var i = 1; i<doc.channels.length; i++){if (//loop finds that there are channels.ChannelType.SPOTCOLOR (they will all be spot colors, componentChannels will never be used) present){
var c1Name = //whatever the first channel's name is.;
var c1Color = newColor();        c1Color.rgb.red = //first channel's rgb.red.value;         c1Color.rgb.green= //first channel's rgb.green.value;              c1Color.rgb.blue = //first channel's rgb.blue.value;        }       //...and so on for as many spot color channels are present. c2, c3, c4 and so on...}

 

I'm not sure if that makes any sense but this is the only way I would know how to continue out the rest of the functions I'd like to perform.  I'm fairly confident I can handle putting together the UI and the rest of the script as needed, it's just actually getting this information and then passing them into variables that's completely boggling my mind.

 

Michael L. Hale put together a great script using the Action Manager instead of DOM objects that's blazingly fast which can be found in this forum, but even in looking that over, I'm at a complete loss of how to tweak this to fit my needs or if this is even what I should be aiming for.  I've also taken a look at the many "channels to layers" posts here but still can't get a grasp on how to do this.

 

Any help, ideas or guidance would be much appreciated as I've yet to wrap my head around arrays.


Viewing all articles
Browse latest Browse all 27456


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>