How to deal with color...

Hi everyone, I’m new.
I have what appears to be a simple problem but in my book (the visual quickstart guide) and online there appears to be no solution.

Here goes. I’m trying to activate an action when I havea certain color centered in the screen. So far, I have this:

tell application "Photoshop"
	set green to "01FA01"
	set conditionx to false
	repeat while conditionx is false
		if color is equal to green then
			run "action x"
		else if color is not equal to green then
			run "action y"
		end if
	end repeat
end tell

Here are the two questions I have:
1: I’m tryign to use the color 01FA01 (that woulf be the html version of the color), which is G:250 R:1 B:1. Is 01FA01 the right term for that color?
2: What do I use to show I mean the color that is centered on screen?

Thanks so much for any help you can give!!


Not even a “I don’t know?”

:frowning: :oops: :cry:

Well, thanks for looking, you 12 viewers :wink:

This will be very difficult since PS doesn’t return much info about a selection and certainly not the color. You could programatically select the center pixel, copy and paste it into a new 1 pixel x 1 pixel image and then process that image using something else to return the color. I bet GraphicConverter could do it (though I’m not positive of this). In OS 9, the Akua Sweets OSAX had a way to determine the color of a pixel on screen but, alas, it was not updated for OS X. I haven’t had much luck using OS 9 OSAXen in X but that might be another avenue to explore.


When you say colour centred on the screen do you mean exactly that, or do you mean the colour of a pixel in the centre of a particular graphic file that you have open in photoshop?

Your comment in relation to html colours compared to the applescript colours is correct.

I am currently working on version 2 of iMagine, I have added the ability to draw individual pixels, and I will be adding the ability to read the colour values of pixels of a graphic file. If this is the type of functionality that you are interested in then I would be interested in knowing that. I hope that this is the sort of functionality that you are after.

I will be looking for a few beta testers in mid January, when I will give a full list of the features at that time.


I mean the center of a file. I had the center of the screen because that seemed easier :shrug: