RButton:: ; sample under cursor color MouseGetPos X, Y PixelGetColor sample, %X%, %Y%, RGB SplitRGBColor(sample,R,G,B) ; convert sample to RGB ; get ps foreground color appRef := ComObjActive("Photoshop.Application") fgc := appRef.ForegroundColor.rgb ;mix with sampled color MixRGB(0.15,fgc.Red,fgc.Green,fgc.Blue,R,G,B,ORed,OGrn,OBlu) ; set ps foreground to mixed color solidColorRef := ComObjCreate("Photoshop.SolidColor") solidColorRef.rgb.red := ORed solidColorRef.rgb.green := Ogrn solidColorRef.rgb.blue := OBlu appRef.ForegroundColor := solidColorRef Return SplitRGBColor(RGBColor, ByRef Red, ByRef Green, ByRef Blue) { Red := RGBColor >> 16 & 0xFF Green := RGBColor >> 8 & 0xFF Blue := RGBColor & 0xFF } MixRGB(alph,R,G,B,RR,GG,BB,ByRef ORed,ByRef OGrn,ByRef OBlu) { ORed:=Floor(alph*RR+(1-alph)*R) OGrn:=Floor(alph*GG+(1-alph)*G) OBlu:=Floor(alph*BB+(1-alph)*B) } Thank you SuperMerlin. I have some code above from a different language (AutoHotKey) and what this script does is that it interacts with Photoshop using COM. The problem is, the script works when just one version of Photoshop is installed (in my case, CC2014), but when a second version is installed (in addition to CC2014), such as CC2018, the script crashes - I'm guessing it can't decide which version it's supposed to interact with (just a guess on my part). So if I remove CC2018, it still crashes. I'm positive it's all to do with the COM interaction (which I know very little about unfortunately). So now, the script no longer works, but it's probably the single most important bit of code I use on a daily basis and I can't get it going anymore. Here's what it does: When the hotkey is pressed (let's say the right mouse button for example), it samples the color currently under the cursor in Photoshop and then mixes 15% of this color with Photoshop's foreground color. So for example, if the color under the cursor is red, and the foreground color is blue, then 15% of that red is mixed into the foreground color. In other words, each time the right button is pressed ontop of the red color, the blue foreground color will move towards the red color, until it eventually reaches the full red (so long as the right button is pressed enough times). Again, each button press moves 15% towards the red. I hope it's not too confusing, but this is some code that would be very beneficial to so many users here. Not to confuse things further, but if you go into the Gradient Tool and then into the Gradient Editor, you can have one end of the gradient color be Red, and the other end be Blue. Just imagine that each time you press the Right Button on the red color (inside a Photoshop document of course, not in the gradient editor), the foreground color is slowly moving along that gradient from the blue end to the red end. I'm trying to find a way to alter the code so it doesn't use COM. I'm getting close, but am running into obstacles. I'd like to post the code here, even though it isn't .jsx, but perhaps somebody could figure this out or maybe find a way to alter it so it's in full javascript. Again, the script is priceless and I'm certain that all Photoshop painters would be ecstatic to have this. Here is the code, and I'm just hoping that maybe it could start something or jog someone's creativity. The actual link that the code is from is found here: https://autohotkey.com/boards/viewtopic.php?t=4984
... View more