Paste Color Data



Another example of the use of JavaScript For Automation, you can put a color on the clipboard which you can then paste in to some applications to set just the color.

Unfortunately it does not work in Mail or Pages (or probably any of the iLife apps), though it does work in TextEdit and in simple styled text fields like Keyboard Maestro’s Insert Styled Text by Pasting field.

Use the JavaScript For Automation script:

var c = $.NSColor.yellowColor;
var pb = $.NSPasteboard.generalPasteboard;
var a = $.NSArray.arrayWithObjects( c );
pb.writeObjects( a );

from an Execute Script action like this: