help making a panel w/ ability to use color picker/eyedrop

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

sAge

help making a panel w/ ability to use color picker/eyedrop

Post by sAge »

cool thanks agAZin for all your help. Cant wait to try it tonight.

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

xbytor

help making a panel w/ ability to use color picker/eyedrop

Post by xbytor »

This is what a colorPicker script would look like.

Code: Select allfunction runColorPicker(defColor) {
  var color = undefined;
  if (!defColor) {
    defColor = app.foregroundColor;
  }

  try {
    var bytes;
    var rgb = defColor.rgb;
    bytes = (rgb.red << 16) + (rgb.green << 8) + rgb.blue;
    bytes = $.colorPicker(bytes);
   
    if (bytes != -1) {
      var c = new SolidColor();
      c.rgb.red = (bytes >> 16);
      c.rgb.green = (bytes >> 8) & 0xFF;
      c.rgb.blue = bytes & 0xFF;
      color = c;
    }
  } catch (e) {
    alert(e);
  }

  return color;
};

function main() {
   var color = runColorPicker();
   if (color) {
     app.foregroundColor = color;
   }
};

main();


This was a copy-paste-edit from an existing script. This may or may not run but it should be pretty close if it doesn't.
-X
sAge

help making a panel w/ ability to use color picker/eyedrop

Post by sAge »

man ayou rock thanksfor taking the time to do that.

I'm going to try it here in a min.

is this a action script, or java script.

Did I mention I'm codeclueless
david

help making a panel w/ ability to use color picker/eyedrop

Post by david »

I'm very new to Flex, but I was able to mash two example scripts together that will accomplish what sAge requested in his original post.

I used the example "colorPicker" code and the code found here:
http://blog.flexexamples.com/2007/08/02 ... d-getpixel

It works fine from a browser, but it won't work in Photoshop.

Anyone know why the SWF compiled from the code on the linked website won't fully work as a Photoshop panel? The browser preview looked fine.
Perhaps it is a security issue?


edit: If I add "-use-network=false" to the compile options, the "get pixel" part works, but the color picker stops communicating with Photoshop.


This is the part it is hung up on:
Code: Select allvar color:int = bmd.getPixel(evt.localX, evt.localY);
sAge

help making a panel w/ ability to use color picker/eyedrop

Post by sAge »

wow that would be perfect ifyou can get by the hang up. have you had any luck?

sAg3
d3mac123

help making a panel w/ ability to use color picker/eyedrop

Post by d3mac123 »

I am using xbytor code to get the color picker selection. However, in some situations I need to open the color picker with an initial color. I have tried everything without success:
Code: Select allrunColorPicker("0xFF0000");
runColorPicker(-1);


All I get is the error TypeError: undefined is not an object

Any idea how could I start the picker with a pre-selected color?

By the way, how to convert "255,0,0" to "0xFF0000"?

Thanks a lot,

Alex