Setting Color differences

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Kukurykus, Tom, xbytor

Mr_Roboto
Posts: 1
Joined: Tue Sep 27, 2016 2:05 pm

Setting Color differences

Post by Mr_Roboto »

Hi, I'm wondering why creating a instance of the variable as seen here, works; I always thought you had to declare constructors differently then just creating a variable and making it an instance ?

Code: Select all

var someclr = new SolidColor();
someclr.rgb.red = 80;
someclr.rgb.green = 90;
someclr.rgb.blue = 50;
app.activeDocument.selection.fill(someclr)
But creating it as this, doesn't work ?

Code: Select all

SolidColor.rgb.blue = 125,
SolidColor.rgb.red = 90,
SolidColor.rgb.green = 70,
ColorBlendMode.MULTIPLY,100,true)

User avatar
Dormeur74
Posts: 32
Joined: Mon Oct 03, 2016 4:56 am

Re: Setting Color differences

Post by Dormeur74 »

I think it is useful to create an instance of any object, like in a true object langage. This is not obligatory in PSscripting if your code is very short. But in a 800 lines code using different variables on the same model, you must work with instances.
Just a last word : your second code cannot work as is. That is probably the reason why nobody answered your question.
Excuse my poor English if my words are not clear.