Is it a way to get a colored button in the ScriptUI DOM ?
I tried
dlg.button1.graphics.backgroundColor = dlg.button1.graphics.newBrush(dlg.button1.graphics.BrushType.SOLID_COLOR,[0.7,0.7,0.7],1);
But although the dialog is drawn, the button is not styled in best case, not visible in the worst case.
Is that possible to get a colored button ?
Hope so.
Do you have any tip ?
TIA
Loic
Hi loic,
I'd like to know the answer to this question as well. I was trying to figure out how to do this for a couple of hours, but it turned out a too hard nut for me to crack. ![]()
I could paint both the dialog and the panel:
var dlg = new Window('dialog', 'Test');
var pnl = dlg.add('panel', undefined, 'My Panel')
var btn = pnl.add('button', undefined, 'My Button', {name:'ok'});
var g = pnl.graphics;
var brush = g.newBrush( g.BrushType.SOLID_COLOR, [0.7, 0.7, 0.7, 1] );
try {
g.backgroundColor = brush;
}
catch(e) {
$.writeln(e);
}
dlg.show();
But when I try to do the same with button, I get an error:
Error: Cannot set backgroundColor property for this element type
Then I tried to set foregroundColor using ScriptUIPen, but failed to create it.
var pen = g.newPen( g.PenType.SOLID_COLOR, [0.7, 0.7, 0.7, 1] );
throws an error: TypeError: Bad argument list.
And the documentation is so obscure on this topic — no examples provided (Graphic Customization Objects chapter in JavaScript Tools Guide). ![]()
I've found only two examples — both by Bob Stucky. He is the only person, I know about, that can do this sort of things.
Here is one more question that keeps me awake at night — the following script sets the text of the button to Arial, BOLD, 12px:
var dlg = new Window('dialog', 'Test');
var pnl = dlg.add('panel', undefined, 'My Panel')
var btn = pnl.add('button', undefined, 'My Button', {name:'ok'});
var g = btn.graphics;
g.font = ScriptUI.newFont("Arial", "BOLD", 12);
dlg.show();
Why do we use graphics object, when we create a new brush?
var g = pnl.graphics;
var brush = g.newBrush( g.BrushType.SOLID_COLOR, [0.7, 0.7, 0.7, 1] );
And why do we use ScriptUI, when we create a new font?
var g = btn.graphics;
g.font = ScriptUI.newFont("Arial", "BOLD", 12);
Kasyan
I have tried in the past but not been able to color a button.
What I have been able to do is use the onDraw callback to print an image instead of the standard control.
You may want to try that.
Wish I could be of more help. Kasyan's correct, the docs are sketchy at best. The biggest hurdle is that some of the custom drawing functionality seems to be a bit brittle and prone to failure in some cases.
Below is an example of drawing an image in place of a dropdown list to make a poor mans' flyout menu.
Regards
Bob
// Ever wanted to embed an image file in a jsx file?
// below is a multi-step process for doing so. It's a little cumbersome but worth the bother at times when a script depends on
// a binary object, but there is no fail-safe way to ensure the binary is delivered or installed with the script (like this sample!)
function myFileStringer( myFile ) {
// read the image file
myFile.encoding = "BINARY";
myFile.open( "r" );
var myBuf = myFile.read();
myFile.close();
// create an output file of the same name with the extension "txt"
var outName = myFile.name.substr( 0, myFile.name.lastIndexOf( "." ) ) + ".txt";
var outFile = new File( myFile.parent.absouteURI + "/" + outName );
outFile.open( "w" );
// write the buffer to the text file using toSource(). The text in the file will be JSON, ready to copy and paste into your script
outFile.write( myBuf.toSource() );
outFile.close();
// open the text file, copy the text in the file in a single line, paste it into your source code as a single line, something like this:
// var myBinary = (newString("\u0089PNG\r\n\x\1\A\n\x00\x00\x00\riHDR\x00\x00\x00... ) );
// it will be a very long string
}
function myFileMaker() {
// the (new String(....) in the line below is the output as pasted from myFileEnstringer
// it is in JSON notation from the toSource() call above - when this line is executed, myBinary will contain an accurate binary representation of the image
// the binary below is a PNG image that is an icon for a flyout menu.
var myBinary = (new String("\u0089PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\t\b\x06\x00\x00\x00;*\u00AC2\x00\x00\x00\tpHYs\x00\x00\x0B\x13\x00\x00\x0B\x13\x01\x00\u009A\u009C\x18\x00\x00\x0FciCCPPhotoshop ICC profile\x00\x00x\u00DA\u00ADWi8\x14\u00EC\u00D7?3\u00C6\u00D8\u00C76\u00C6\u00CEX\u00B2d\x1B\u00FB\u0096u\u0090\u009D\u00EC$\u008C\x19\u00CBX\u00A7\u00B1/\u00A1B\u008F\u0088\u00B4\u00A1\u0088\x14i\u00A1\u0094\u0084\u0092\u00AD\u00B2\u0094\u00A2\x12ey\u00B2\u00A6B\"K\u008B\u00E6\u00FD\u00A0\u00A7\u00E7\u00BA\u00FE\u00EF\u00F5\u00BE\u00EF\u0097\u00F7|\u00FA\u009Ds\u009Ds~\u00E7\u00BE\u00CF}]\u00E7>\x00\u00BCB$\x1A-\x02\t\x00\u0091Q\u00B1t\u0097\u00DD\u00E6x/o\x1F<\u00CBk\u00E0\x04~\u00C0\u0082>H\u0092\u00C8143gg{\u00F8\x1Fe\u00FD5 \x00\x00^\u00AA\u0090h\u00B4\u0088|\u00F6\x00J\u00DF\u00D4\u00D9\u0092z\u00C3\x15\u00E7/\u00B2\u0087d\u00E1\x7F\x17\f\u00DD\u00CB\u00DB\x07\x00\u00A1\f\x00\u00D8\u0090ml\n\x00\u00D8\u00C0m\u00EC\x06\x00\u00D8\u0084XZ,\x00\"\x14\x00\u00B0\u00E4P\x12\x05\x00\u0091\n\x00\u00CAt7\x17\"\x00\u00A2\x06\x000!\u00DB\u00B8\t\x000\u0081\u00DB\u00B8\x07\x000\u00F1\u00E4\u0090X\x00\u00C4\b\x00\u009A/\u008AB\u008D\x02`Y\x00@\x1BS\u0082b\u00C8\x00\x18e\x00\u00A0Pb\u00C8\u0091\x00\u0098\u00E3\x00H\u00D5\u00C8\u00C8h\n\x00O;\x00(\u0090i\u00F4X\x00\u009Ey\x00P\u00F1\u00F2\u00F6\u00C1o\u0097L\u00D9\x000@\x01\u00A0\u00DF\u00FEk\x0B\u0093\x02\u00A8\u00BD\x03 &\u00F5\u00AFM\u00FE\x01\u0080\x10\t\u00E0\u00E6\u00CE\x7Fm\u00AB.\u0080\x00\x00\x04\u00EEyL\u00B0\u00A6\x06\x00\x00 8\u00CD\x01\u0098'\x18\u008CU9\x00\u0096\x13\x00[\u0085\f\u00C6\u008FJ\x06c\u00EB\"\x00\u00D3\x18@{\x049\u008E\x1E\u00FF\u00FB\u00BE\x10\u0088~\u0080\u00FFK\u00DF>\u00F3oaB\x00 \x01\u0090jL\u008E\u00A8P\u00E6\x03\u00E8\x12\u0096\u009B\u00AC\u009Dl#\u00EC\u009F8V\u00B8\u00D81\u0082\u00DCR<*\u00BC\x06|f\u00FC\u00F6X7\x01O\u009C\u009F Y\u0088*L\x13\u0089\x11\u008D\x15\u008B\x13O\u0094H\u0091\u00CC\u00C0gJeJ\x1F\u00919*\u009B\u00BF\u00E3\u00B4\u00DC9\u00F9\n\u0085\x1A\u00C5\x1B;\u009B\u0094\u00BA\u0095\u0087T&U\u00D7\t\u00EC\u00EA\u00D2\x1A\u009A\u009A\u00EEZ)\u00DA\x15:}\u00BA\u009B\u00FA\u008A\x06$\u00C3s\u00BB\u00C6\u008D%M\u00A8\u00A6w\u00CD9\u0089\u00FB,n[\u00F1\u00ED\u00A6[\x0F\u00DA\u00AA\u00D9\x1D\u00B3\u00FF\u00E2h\u00EFT\u00B7\u0087\u00DB%\u00C2\u00B5\u00CF]\u00D4#\u00C2\u00F3\u00817\u00C6\u00C7\x7Fo\u008D\u00EFW?\u00A2\u00FF\u00D1\u0080\u00FE@n\u00B2\x13\u00E5D\u00D0\u00F3\x10\u00F6P3j\\X]\u00F8d$\x7F\u0094Et\x02\u00ED\u00FA\u00FE\u00B71\u00A8XB\u009C\x7F|^\u00C2\u00FD\u00C4\u00F9d\u00DE\x14\u00E3T\u00DA\u0081\u00F2\u00B4\u00EE\u00F4\u00B1\u008C\u00A9\u0083\u00B3\u0087\x16\x0E/g\u00AEd\u00ADgo\u00FD\u0085\u00CA\u00E1<\u00CA\u009B+\u0090'~L!_\u00B3\u00C0\u00F0\u00B8Y\u00A1\u00F5\u0089='=N\u00F9\u009C\u00F6;C.\u00A2\x16\u0087\u0097\u0084\u009F\u00A5\u009E\u00A3\u0096\u0086\u0095\u0085\u009E'\u0095\u00FBT\u00B8^\u00B0\u00AB4\u00BD\u00A8~I\u00B1J\u00BEz\u00C7e\u00E9\x1A\u00FC\x15\u00F1\u00AB\u00C2\u00D7\x04\u00AE\u00F3\u00D6\u00F2\u00D4q\u00DE`\u00BE\u00F1\u00EB\u00E6f\u00FD\u00EA\u00AD\u00C5\u00DB\u00B3\r\u00A3w\x06\x1B\u009F\u00DE\u00EDjjn\u00AEo\u00B9~\u00EF\u00CA\u00FD\x0B\u00ADg\x1E\u00E4\u00B7\x1Dm\u00CF\u00EC8\u00D8\u0099\u00DCE\x7F\x18\u00F5(\u00EAqD7\u00A9\u0087\u00D8\u008B\u00EB\u009D\u00EA\u00BB\u00F5$\u00FD\u00A9m\u00BF`\u00FF\u00DC\u00B3\u0086\u00E7\u0099\x03.\u0083\u0092\u0083\u008B/\u00DA_\x16\u00BE\u00F2\x1FR\x19\u00FA\u00FE\u00FA\u00C9p\u00D1\b\u00E9\u008D\u00CA\u009Boo\x1F\u008F\x16\u008Cy\u008C\u008B\u008F\u00CFL\u00D4\u00FEM\x7F\u00A7\u00F3\u00EE\u00DBd\u00CBT\u00CA\u00B4\u00C1\u00F4\u00FAL\u00E3l\u00EA\u009C\u00D9{\u00A6\u00F7\u00BD\u00F3y\x1F\x1C?\u00F2||\u00F9\u00A9h\u00C1kQhqd\u00A9\u00F8\u00B3\u00D7\u00B2\u00D0\u00F2\u00D0\u0097\u00C2\x15\u00C7U\u00AE\u00D5\u00DE\u00AF\u0099kfk\u008C\u00F5\x07\x1B\u00C9\u009B\u00DA\u009B\u00CB\u00DFj\u00BF\u0087\u00FFP\u00FC1\u00F7\u00B3r+\u00E0\u0097\u00E4\u00AF\u00B7\u008C\u00FD\f\x06\x00\x12\u00C5\u00C4\u0087\u00C21c\u00D1\x02,\u00DC\u00AC\x1Cl\u00ACl[\u00EC\u00DF8>s\u00CEp\u00BD\u00C1\u00F4sw\u00F0\u00D4\u00F3V\u00F2\u009D\u00E2\u00CF\u00C2&\b\u0084\u00E3\u00F6\t:\t\x11\u0085\u00F5EtD\u0095\u00C5\u00D4\u00C4U%t$\u008D\u00F1\u0096R&\u00D2z2*\u00B2\u00CA;\u0094\u00E5v\u00CA\x13\x14\u0094\x15\t;u\u0094\u0088\u00CA\u00B6*^\u00AAT\u00B5$B\u008Ez\u0099F\u00A3\u00E6s\u00AD%\x1D^]-=W\u00FDd\u0083\u00CB\u0086\u00C3F\u00AC\u00C6\u00DA&\u00FBMk\u00CD\u00E6\u0089J\x16\u00E1\u00967\u00AC6\u00AD-mrmG\u00EC\u00D5\x1DR\x1D\x07\u009DE\u00F7\u0084\u00B84\u00BA!\u00DC\x1D<Nx\u008Ey+\u00FA\u00D0\u00F6\u00DE\u00F2\u00DD\u00F0\u00D3\u00F3?\x10\u00D0F\u00DA\"\x1BR\u00E2\u0083\u00EE\x06\u00AF\u0086\u00AAR\u00C3\u00C2\u00AE\u0086\x7F\u008C\u0094\u008B\u00F2\u008D.\u00A6\u00BD\u00A6\u00F3\u00C7\u00B8\u00C5\x16\u00C6\u00F5%\u00B0&\u00DA'\u00E5'?J\u0099N\u00FDt\u00E0s\u00DAZ\u00FA\u00B7\u008C\u00EF\x07\x7F\x1Df\u00CE\u00E4\u00CC\u00E2\u00CF\x16>\"\u00FE\u0097l\x0E\u00E1\u00A8A\u00AEy\u009E\u00CD1\u00A7|\u00AF\x02\u00DF\u00E3\x01\u0085\u0094\x13a'\u00A3O\u00D1N\u00D3\u00CFD\x17E\x15\u00D3J\"\u00CF\x06\u009F\x0B(\u00F5*s>oY\u00AES\u00A1rA\u00A5R\u00F9\u00A2\u00E2%\u00C5*\u0085j\u00B9\u00CB\u00B252Wd\u00AF\u00CA\\\u0093\u00BC.V+R'|C\u00E8\u00A6@=\u00DF-\u00EE\u00DB\u00DC\r\u0098;\\\u008D\\wy\u009Bp\u00CDB-B\u00F7D\u00EF\u00E3[\u00E5\x1F\u00A8\u00B6i\u00B7\u00EBw\u0098w:v\u00F9<\u00DC\u00FBh\u00F7c\u00FC\u00E3\u0095\u00EE\u00DE\u009E\u00D2\u00DE\u00C8>\u00B3'\u0082O\x16\u009F>\u00EA/y\x16\u00F9\u009C8 >\u00B0>\u00D8\u00FF\u00A2\u00F2e\u00C2+\u00C7!\u00E9\u00A1\u00B5\u00D7\u00BD\u00C3\u00A5#\u00D1o\u00CC\u00DE\u00F2\u00BE\x1D\x1F\u00BD>\u0096:n=\u00C1;1\u00FAw\u00E5\u00BB\u00B0I\u00D5\u00C9\u00E5\u00A9\u00A6\u00E9\u00E33\u00A1\u00B3&s\u0082s\u008B\u00EF\x1F\u00CE\u0097|\u0088\u00FAh\u00F9I\u00F8\u00D3\u00C7\u0085\u00FB\u008B\u00C7\u0096\u00F6}V\u00FD\u00FCc\u00B9\u00FB\u00CB\u0089\x15\u00BFU\u00C5\u00D5\u0095\u00AF\u00F7\u00D6\u00B2\u00D7\u009D7\u00846\u00C66+\u00BFQ\u00BF\x13\u00BEo\u00FE\u00B8\u00FF3c\u00CB\u00F2\x17\u00E6\u00D7sF\u00E4v\u00FF\u0091\x1BL\u00CB\u00A8\u00AF\u00CC\u009F\u00D1\u008B,\u008B\u00AC\u008Bl\x13\u00EC\u00A3\x1C\u00AF8\u009Fp\u00B5b\u00EA\u00B8\u00CByry\x13\u00F8(\u00FC\u00F6X\u0082\x00\u00B7\u00C0*nP\u00F0\u009AP\u00A6\u00B0\u00AF\bA\u0094YtX\u00ACJ<N\u00C2R\u0092[r\x1C_%\x15)m \u0083\u0096y-{eG\u009A\u009C\u00BB\u00BC\u00B2\x02\u00AB\u00C2{\u00C5\u00EE\u009D5J\u00C7\u0094cU\u00F6\u00AA\u009A\u00AB\u00A9\x12\u00C4\u00D4\u00D9\u00D474f5\x07\u00B5\u00DA\u00B5o\u00EA\u0094\u00E9\u00E6\u00E8\u00C5\u00EB\u0093\f\u00EC\rw\u00ED\u00C2\x1B\u00A1\u008D\u0096\u008D\u0087L\u00EE\u0098\u009E4\u008B7\u00A7\x12=-\u00AC,\u00F5\u00AC\u00E4v\x0BY3[\u00AF\u00DB|\u00B0}c\u00D7c\u00DF\u00E8P\u00EDX\u00EC\u0094\u00E3\u009C\u00B8'\u00C4\u00C5\u00C3\u00D5\u00DE\u00CD\u00D0]\u00D9C\u00D2\x13\u00E7\u00C5\u00E5\u008D\u00F4\u00FE\u00EA\u00F3a\u00EF\u0094\u00EF\u00DB}\u00AF\u00FC\u00FA\u00FD\u00BB\x02\x1E\u0090Z\x03[\u00C8\u00B7(\x17\u0083r\u0082\u00E9!\u00FE\u00A1\u00D6T\u00B50\u0091p\u0096\u00F0\u00B5\u0088\u0099\u00C8\u00C1\u00A8\x07\u00D1u\u00B4\u00CA\u00FDg\u00E8\x7F\u00C5$\u00C6\u0086\u00C6\u00F9\u00C5;&\x18'\u00AA%I%cSP)\u00AB\u00A9\u00EF\x0E<K{\u0090~-\u00E3\u00D4\u00C1\u00F4C\u00C1\u0087\u009D2\u00B5\u00B2p\u00D9\u0088\u00EC\u008D#\u008B\x7FM\u00E7\u00BC=:\u0090\u00DB\u009D\u00D7r\u00ECF~MA\u00E9\u00F1\u00DC\u00C2\u00F4\x13\u00B4\u0093\u0094S\u00EE\u00A7\u00AD\u00CEh\x15\u00C9\x16\x0B\u00940\u0097|=;{n\u00A4\u00B4\u00BF\u00EC\u00C1\u00F9\u00EB\u00E5e\x15'/dU\u00A6^\u008C\u00BED\u00AA\u00F2\u00AC\u00DEs\u00D9\u00A6\u00C6\u00F0\u008A\u00F4U\u00B8:v\u00ED\u00FE\u00F5\u00E2Zz\u009D\u00D3\r\u00D5\u009B\u0098\u009BK\u00F5\u00FD\u00B7\u00AE\u00DC\u00CEm\u0088\u00BE\u00E3\u00DA\u00A8}\x17ww\u00A3i\u00AC\u00B9\u00B5\u00A5\u00EC^\u00DA}R+\u00F1\u00C1\u008E6\u00E6\u00B6\u00E9\u00F6\u00AE\u008E\u00EA\u00CE\u00CC.\u00D2C\u00A3G\"\u008F\u00D6\x1F\x0FtW\u00F5\u00E4\u00F6\u0096\u00F6u<\u0099z\u00CAx&\u00F2\\\x7F\u00C0g0\u00F5E\u00E9\u00CB\u009EW\u008B\u00AF\u00C5\u0086\u009DFr\u00DF<\x1D\u00E5\x1F\x0B\x18o\u00FE\u009B\u00FF]\u00FA\u00E4\u00D7\u00E9\u0083\u00B3\u0098\u00B9\u00CB\u00F3\u00CE\x1Fy?\u00BD^\u00AC\u00FB|\u00E6K\u00E1j\u00D9Z\u00FD\u00C6\u00DCw\u00FC\u00CF\u0080_i\f\x06\u00C0\u00F6\u00EC\x03\x00@\u00EB\x00\x14\u00C7\x01xM\x02\u00B8T\x01\x14l\x01(p\x02\u00E0j\x00\u009C\u00B9\x00\u00DC\u00F4\x01\u00D1Y\x00\u0088kY\u00800/\u00F8g~\x00\x00\x12X\u0081\x17$@\x05L\u00C0\r\" \x1B.\u00C2C\u0098E\u00B0#4\x10\u00BE\u0088\u00BF\x10M\u0088\x0FHq\u00A4;2\x1F\u00D9\u00C7\u00C4\u00CAd\u00CD\u0094\u00CB4\u0088\x12AQP\u00F5(\x06\u00B3\x13\u00F3E\u00E6ohg\u00F4U\x16\x14\x0B\u0089\u00A5\u009DU\u008A\u00F50\u00EB<\u009B\x03[=\u00BB\b{&\u00FB\x02\u0087'G'\u00A7\x06g\x19\x17\x0BW\x1C\u00D7\x14\u00C6\t\u00D3\u00CA\u00AD\u00C4]\u00CC\u00C3\u00C2\x13\u00C33\u00C9\u00EB\u00CC\u00DB\u00CA\u00A7\u00C4W\u00CC\u00CF\u00CC\x1F\u00C7?\u008Bu\u00C5v\b\x10\x04*p|\u00B8,\u00DC7\u00C1\b\u00C1wB\u00DEB\u00CF\u0085w\x0B\u00B7\u008B\u00EC\x12i\x14\u00D5\x11m\x113\x16\u00EB\x14\u00B7\x16\x1F\u0090\u00F0\u0092\u0098\u0095\u00A4K2\u00F0yR\x12R\u00B7\u00A5m\u00A4'eRd\u00B1\u00B2\u00F5;\u009Cw\u00AC\u00C8\x15\u00C9\x1B\u00CBO+\u00E4)\u00EA+\u00CE\u00ED<\u00ADd\u00A1\u00B4\u00AA\\\u00AD\u00E2\u00A7*\u00A4:\u00A0\u0096C\u00B0T\x07\u00F5V\u008DtMs-&\u00ADN\u00ED,\x1D{]\t=\u00A4\u00DE\u0092\u00FE\u00B0A\u00A7\u00E1\u00ED]UF\u00A7\u008C\u00B3L\x12L\u00C3\u00CC\u00C8\u00E6\u00FB\u0088\u00AE\x16\u00D6\u0096\u00E6V&\u00BBM\u00ADMmLmw\u00DB9\u00DB\u00FB8\x049\u00D2\u009C\x0E;\x17\u00ED\u00A9w\u00E9u\u009DtGx\u00C8{:x%xW\u00FA\f\u00FBr\u00EF3\u00F0#\u00FB\u009F\n\u00E8$\u00AD\u0092\u00E5)~AE\u00C1\u00FD\u00A1h\u00EA\u00EE\u00B0\u009C\u00F0\u00FEH\u009E(\u008F\u00E8\n\u00DAg\u00BAYLn\u00EC\u00DF\u00F1Z\t9\u0089c\u00C9*)GR\u00E7\u00D3,\u00D2\u00CB2~\x1C\u00F28\u00DC\u009C%\u0099\u009Dv\u00E4m\u008E\u00C9\u00D1;y\u00BE\u00F9b\x05C\u0085%'\x03O\u00CB\u009C\u00F9X\\w6\u00AD\u00D4\u00E1<\x7F\u00F9\u00E4\u0085\u00C6\u008B\u0085U\u0094\u00CB\u00D6WT\u00AFa\u00AF\u00FF\u00A8[\u00BA\u00F9\u00FE\u00D6L\u00C3D\u00E3|\u00D3\u00DA=\u00CEV\u00996\u00C7\u008E\u00E8\u00AE\u00F4G\x15\u00DD-\u00BD\x13OY\u009E\x11\x06\u00BC^\x1C\x7F\u00D53\u008C~C\x1C\u00CD\x1D\x1F{'7\u0095:3\u00F4~\u00E7\u0087\x03\u009F\u00A6\u0097l\u0097\u00AF\u00ACr\u00AC\u00C5l\u00CC|\u00B7\u00FAy\u009F\u00C1\u00D8\u00FEI\x00;\b\u0080,\u00E8\u0080=\x04\u00C1A\u00B8\x00]\u00F0\x01\u00C1\u00870FD\"\u00CA\x11CH.\u00A452\x1B\u00F9\u0098\u0089\u008D\u00C9\u0089\u00A9\u0088i\x12\u00A5\u0084JFu3\x0B1\u00872\u00B7\u00A01h*\u00BA\u009BE\u0091%\u0087\u00E5\x13\u00AB3k\x03\u009B\x04\u00DB\x11\u00B6/\u00EC>\u00EC=\x1C\u00DA\x1C\u0095\u009C|\u009C\u00879\u00D7\u00B9B\u00B8\u00DEb\u009C0\x1D\u00DC\u00DA\u00DCWydx\u00CE\u00F2\u00F2\u00F0\x1E\u00E1\u00FD\u00C5\x17\u00CF\u00B7\u00C2O\u00E5\u009F\u00C4\u00EE\u00C5\u00BE\x16p\x14\u00E8\u00C3Y\u00E1:\x04\u008D\x04\u009B\u0084t\u0085\u00EE\nk\n\u00D7\u0089\u00A8\u008B\u00DC\x10U\x17m\x123\x16\u00EB\x12\u00B7\x13\x1F\u0092\u00F0\u0097X\u0092L\u00C5\u00B3\u00E1\u008B\u00A5vJ\u00B5K\u00BBK/\u00C8d\u00CBJ\u00C86\u00EF\u00F0\u00D8\u00B1.W$o(?\u00AA\u0090\u00A1(\u00AF\u00F8|g\u00A2\x12^\u00A9G9FEJ\u00E5\u0095j\u00A6\u009A\u00A6\u00DA\f\u00A1H\u00DDZ}K\u00A3Q3JKVkD\u00FB\u00B8\u008E\u0083.Nw]oJ\u00FF\u0089A\u00A3\u00E1\u00E5]g\u008Dr\u008C\u0093M\"L\u00FD\u00CD<\u00CD\u00F7\x10\u00AD-\u008C,u\u00AD\u00B4vkY\u00EB\u00D8h\u00DB\x1A\u00D9Y\u00D9;;\u00F88\x06;%9\u00E7\u00ED\u00A9vis\x1Dv\u00DB\u00F0\x10\u00F74\u00F7\u008A\u00F4.\u00F6y\u00EA\u00CB\u00BC\u008F\u00E0\u00E7\u00E9\x7F$\u00A0\u00814E\u00C6R\u00AC\u0083\u00D2\u0082\u00EBC\u00E6\u00A82a\u00A4\u00F0\u00F2\u0088\u0089(\u00B1h\x7FZ\u00D5\u00FE\u00A5\x18\u008D\u00D8\u00A4\u00B8\u0087\t\u0098D\u008F\u00A4\u00D2\u00E4\u00D9T\u009D\x03\u00D9i/2$\x0FF\x1Cj\u00CE\u00E4\u00CA\"e\u00D7\x1D\u00F9\u009E\u00E3p\u00F4V\u009E\u00CD\u00B1\u00AD\u0082\u009AB\u00BF\u0093\u00C2\u00A7\u009E\u009E9\\\u00AC[\u00B2v\u00AE\u00B1,\u00AA\\\u00A1b\u00BE\u00F2\u00E6\u00A5\u0084j\u00D3\x1A\u00FE+\u00EF\u00AF\u00DD\u00AF=}#\u00BE>\u00F0\u00B6\u00DD\x1D\u009D\u00BB\u00EA\u00CD\u00AA\u00F7\u00B4Z\u008D\u00DA\u00BC:(]f\u008F\u00D4\u00BBEz9\u00FB\u00B6\u009En>[\x1A\u00F8\u00F0\u00E2\u00EB\u00AB\u009F\u00C3\x1CoDF\u00B5\u00C6=\u00FFN\u0099\u00AC\u009C~9\u0087\u009A\u00D7\u00FA\x18\u00BE\u00D0\u00B0\u00B4\u00F1\u00C5h\u00F5\u00E0\u00DA\u008BM\u00C5\u00EF\u00F4\u009F\u00AF\u00FE\u00F4\u009F\x03\x04A\x0E\u00F4\u00C1\tB!\x13\u00AA\u00A0\x1B\x16\x118\x04\x11\x11\u0083\u00A8FL \x05\u0091\u00EE\u00C8\"\u00E4\x04\u0093\x1CS,\u00D3c\u0094\x18*\x015\u00C4\u00AC\u00C7\\\u0081fG\u00A7\u00A0\x17YBY\u00A6X\x03X'\u00D8\u00F6\u00B1M\u00B0\x07\u00B2\u00CFrP9\u00969\x138\x19\\9\x18\x1C\u00A6\u0092[\u008D\u00BB\u008Dg\x0F\u00CF,\u00EF\x01>,_\x1D\u00BF\x03\u00FF\"\u00B6P@W`\f\u0097'\u00B8KpA\u00E8\u0092p\u00A0\u0088\u00AC\u00C8\u0090h\u00BE\u0098\u00B58B\u00BC]\"M\u00D2\x1C\u008F\u00C2wK\x1D\u0097\u00DE+\u00A3 \u00B3&\u00DB\u00B5\u00E3\u008C\\\u00B8<Q\x01\u00A7\u00F0E\u00F1\u00E9\u00CE\u00CBJ\x07\u0095}U\u008CU\u00A5\u00D5\u0098\u00D4f\t\u00BD\u00EA\u00B5\x1AE\u009A\x07\u00B5\u0082\u00B5\x1Duv\u00E9\u00AA\u00EB\u00E9\u00EA\x1B\x19\u0098\x1A\u00DA\u00EC\u00F24\"\x19\u0087\u009B\u00C4\u009B\x1E6;m~\u0099x\u00DB\u00A2\u00D3r\u00C8\u00EA\u00935\u00CAF\u00C8V\u00DB\u00CE\u00CD>\u00C6\u00E1\u0084c\u0083\u00D3\u00E8\x1E\u00B4\u008B\u0096\u00AB\u00BF[\u0081{\u00AF'\u00C2\u00CB\u00CC;\u00DD\u00A7\u00DBW`\u009F\u00BD_\u009A\x7FS\u00C0R\u00A0\"\u0099B\u00A9\x0E\u009A\x0F\u0091\x0B\u008D\u00A0\u00B6\u0084\u00A3\"\u00DC\"/D}\u00A5\u00D9\u00ED\u00AF\u00A63b\u00BD\u00E3\u009A\x13\u0084\x13\x13\u0092^\u00A4h\u00A5\u0096\u00A7\u00A1\u00D3C3\x06\x0Ei\x1D.\u00CF\u00C2d\u00C7\x1F\x19\u00CD\u00D9}\u00B4#\u00CF\u00E3\u00D8FAa\u00A1\u00E6\u0089\u00F1S\u00E9g\u00A4\u008B\x1E\u0095\u0084\u009F\x13-\u00ED8O\u00AE\u00E0\u00B8\u00D0|1\u00AC\n[\u00DDS\u0093qU\u00E7\u00DABm\u00D5\rJ\u00BD\u00E2\u00AD\u00A5\u0086\u00DA\u00C6\u00A4&\u00BB\x16\u0089{+\u00AD\u00CF\u00DA\u00EEv$u\u00CE?t|t\u00BF\u009B\u00D0s\u00B5O\u00E2\u00C9\u00C9~\u00F4\u00B3\u00A4\u00E7\u00AB\u0083\u00DE/\u009E\u00BD\u00D2\x1B*\x1F\u0086\x11\u00EF77GQc\u00EE\u00E3\u00E7'&\u00DE\u00C9N\u00FAN\x1D\u009B\u00BE732\u00BB\u00F6\x1E;\u00AF\u00F4\u00C1\u00F4\u00A3\u00E3'\u0097\x05\u00A7E\u0087%\u00DB\u00CF&\u00CB\x1A_\u00F0+\u00EC+\u009FW\x07\u00BF\u00D6\u00AD\u00E5\u00ADS7\u00CC7y6'\u00BE]\u00FF\u009E\u00FC\u00C3\u00E6\u00A7\u00E0\u00CF\u00F1\u00AD\u00B2_]\f\x06\u00C0\u00F6\u00BE\x04\x00\x00\u00EC\u00C4\u00E8\u0088h:\u00DE\u009Eh\x01\u00FF\u00BF\x12\x19\x11\u00F7\x0F\x07\x0F\x00pRcm\u00DC\x00\x00\x0B\x00\x03\u00C1t+\x17\x000\x07\u0080\u0099\u00A8@G'\x00\u00E0\x03@\u00C8\x05\u00C5X\u00BA\u00FE\u00C6z\u00C1T+\u009B\u00EDX\u0084--\u00D6\u00D9\r\x00\u0084\x00\x10>\u00C9\u00A1n\u009E\x00\u0080\x01@\u00D0\u00C3H\u00B6\u00CE\u00BFqFT\u0084\u00A3=\x00\u00E0\x00\x10\u00F9\u0094 \x0B\u00CB\u00DF\u00B1\u0097\u00E8q.\u00EE\x00 \x0B\u0080h\b\u008F\u00B6s\x01\x00N\x00\u00C4HP\u0094\u00FB?\\31\u00F1\u00AE\u00FF\u00F8\u00AFSH\x16v\x00 \x06\u0080D'\u0087\x12\x1D\u00B7\u00FD\u0091\u00D2`\x0FD\u00B0\x00<\u0090!\x1A\" \x1A\u00E8@\u0085^ \x03\x1DH\x10\x05xx\x07x \x03\x1D\u00A8\x10\x03\u00B1@\u00828H\x04<D\x00\x15\u00F6C\x1CP\u0081\x02A\x10\u00F3;>\x0E\" \b\u00E2\u0080\x0EV@\x02:\u0084@\x10\u00A8\u00FCf\u00F8\u00EF<\x1E0\x03t\u00A0\u00FE/\x1ET\u00A0@\u00B4?\u00F5\x10=\u00F2Vp|qt\u0092\u0081G(\u00E1\x1A\u00E1\x03\u00E1'\u00E0\x7F{\u00DB\u00FDa\f\u0082\u00A8?\u0099\u00B6\u00D9\x03\u00FF\u00D1Qr(\r\u00946\u00CA\x1Ce\u00842F\u00E9\x03\x1E\u0085C\u0089\u0080\nJ\x0B\u00A5\u00872C\u0099\u00A0\fQ\u00DA(\u00FDg\x0Bw\x17\u00FEd%\u00FE\u00A9\x00\u00FF'\u00E3\f\u00D0!\u00E4?jU\u0081` \x01\x1D\u00E2!\bb \x1C\u00E6\u0080\x0E\u0091\u00FE\u00D4C\u00FF\u00C6\u00C1\u00F6\u00AE\x0E\x00\u0080\u00E6\x01(\r\x00\x00h\u00DBL\u00C9\u00F8\u00CFw\x15\x1B\u0094\x18\x0B\x00@\u008C\u00A6%\u00D1\u00A9!\u00A1\u00B1x3\x1A-\"\bO\u008C\u008E\u00A4\u00C5\u00C5\x06\u00D1\u0095\u00F16QdUe\u00BC\x06\u0081\u00A0\r\x00\u00F0_\x14\u00F7T\u00A9\u00D4J\u008B\u00F2\x00\x00\x00 cHRM\x00\x00m\u0098\x00\x00s\u008E\x00\x00\u00E2\u00F9\x00\x00\u0086\u0099\x00\x00x\u0083\x00\x00\u00D4N\x00\x003\u00BC\x00\x00\x1Cyc\u00E1\x1F,\x00\x00\x00\u00A2IDATx\u00DA\u0094\u0091\u00B1\r\u00840\x10\x04\u00C7>\x07\u00D0\n=P\x07\x05\u0090\"\u008AA\u00A4\u00D4@\x05n\u00C3]\\\u008C\x03l\x7F\u00F0\x12\u00C9\x0B\u00F0_x\u00BA\u00DB\u00DD\u00D1\x1AU-)%D\x04\x11!\u00E7L)\u0085\u00DAq\x00\"\u0082\u00B5\u0096\u0094\u00D2\u00CF\u00C14M\u00B7\u00CF\u00EB\u00BAbT\u00B5\x18cn]\u009B\u00A6\u00B9\x15\u00881~\x13<E\u008E1\u00BE#\u00EC\u00FB\u008E\u00F7\u00FEZ\u00F6}\u00CF0\f\u00F5\b\u00CE9\u0096e!\u0084@\u00D7u\u00CC\u00F3\u00CCy\u009EU\bFU\x0B@\u00CE\u0099m\u00DB\x18\u00C7\x11kmu\x0B\u0097\x00@\u00DB\u00B6\x1C\u00C7\u00F1\x7F\x0BO\x0Eo\b\u009F\x01\x00\u009B\u00FDU\u00A2t\u00A1Hz\x00\x00\x00\x00IEND\u00AEB`\u0082"));
// create a data folder for your script in the user's application data
var myDataFolder = new Folder( Folder.userData.absoluteURI + "/SampleScripts" );
// make certain the folder exists
myDataFolder.create();
// write the image file
var myFile = new File( myDataFolder.absoluteURI + "/myFile.png" );
myFile.encoding = "BINARY";
myFile.open( "w" );
myFile.write( myBinary );
myFile.close();
// there is now a valid png image in your script's user data folder
}
// example of using ScriptUI's drawing api to make a dropdownlist draw as an icon (until the user clicks it, then it's a menu)
myFlyout = function( palette ) {
palette.myFlyout = palette.add( "dropdownlist", [ ( palette.frameSize.width - 20 ), 0, palette.frameSize.width, 20 ] );
palette.myFlyout.onDraw = function() {
this.graphics.drawImage( ScriptUI.newImage( myIconFile ), 0, 0 );
}
if ( !palette.onShow ) {
palette.onShow = function() {
this.myFlyout.draw( this );
}
}
}
// A slightly more complex example putting it all together where you can pass a callback function and an array of menu items
// this function will add a flyout menu to the top-right corner of any ScriptUI window. It does not need to be a palette.
addFlyout = function( palette, menuItems, callback ) {
// create a script data folder to contain resources such as the flyout icon
var myScriptDataFolder = new Folder( Folder.userData.absoluteURI + "/SampleScripts" );
myScriptDataFolder.create();
// point a file to the expected location of the icon image
var myFlyoutIcon = new File( myScriptDataFolder.absoluteURI + "/flyoutIcon.png" );
if ( !myFlyoutIcon.exists ) { // if it's not there, then create the file
var binData = (new String("\u0089PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\t\b\x06\x00\x00\x00;*\u00AC2\x00\x00\x00\tpHYs\x00\x00\x0B\x13\x00\x00\x0B\x13\x01\x00\u009A\u009C\x18\x00\x00\x0FciCCPPhotoshop ICC profile\x00\x00x\u00DA\u00ADWi8\x14\u00EC\u00D7?3\u00C6\u00D8\u00C76\u00C6\u00CEX\u00B2d\x1B\u00FB\u0096u\u0090\u009D\u00EC$\u008C\x19\u00CBX\u00A7\u00B1/\u00A1B\u008F\u0088\u00B4\u00A1\u0088\x14i\u00A1\u0094\u0084\u0092\u00AD\u00B2\u0094\u00A2\x12ey\u00B2\u00A6B\"K\u008B\u00E6\u00FD\u00A0\u00A7\u00E7\u00BA\u00FE\u00EF\u00F5\u00BE\u00EF\u0097\u00F7|\u00FA\u009Ds\u009Ds~\u00E7\u00BE\u00CF}]\u00E7>\x00\u00BCB$\x1A-\x02\t\x00\u0091Q\u00B1t\u0097\u00DD\u00E6x/o\x1F<\u00CBk\u00E0\x04~\u00C0\u0082>H\u0092\u00C8143gg{\u00F8\x1Fe\u00FD5 \x00\x00^\u00AA\u0090h\u00B4\u0088|\u00F6\x00J\u00DF\u00D4\u00D9\u0092z\u00C3\x15\u00E7/\u00B2\u0087d\u00E1\x7F\x17\f\u00DD\u00CB\u00DB\x07\x00\u00A1\f\x00\u00D8\u0090ml\n\x00\u00D8\u00C0m\u00EC\x06\x00\u00D8\u0084XZ,\x00\"\x14\x00\u00B0\u00E4P\x12\x05\x00\u0091\n\x00\u00CAt7\x17\"\x00\u00A2\x06\x000!\u00DB\u00B8\t\x000\u0081\u00DB\u00B8\x07\x000\u00F1\u00E4\u0090X\x00\u00C4\b\x00\u009A/\u008AB\u008D\x02`Y\x00@\x1BS\u0082b\u00C8\x00\x18e\x00\u00A0Pb\u00C8\u0091\x00\u0098\u00E3\x00H\u00D5\u00C8\u00C8h\n\x00O;\x00(\u0090i\u00F4X\x00\u009Ey\x00P\u00F1\u00F2\u00F6\u00C1o\u0097L\u00D9\x000@\x01\u00A0\u00DF\u00FEk\x0B\u0093\x02\u00A8\u00BD\x03 &\u00F5\u00AFM\u00FE\x01\u0080\x10\t\u00E0\u00E6\u00CE\x7Fm\u00AB.\u0080\x00\x00\x04\u00EEyL\u00B0\u00A6\x06\x00\x00 8\u00CD\x01\u0098'\x18\u008CU9\x00\u0096\x13\x00[\u0085\f\u00C6\u008FJ\x06c\u00EB\"\x00\u00D3\x18@{\x049\u008E\x1E\u00FF\u00FB\u00BE\x10\u0088~\u0080\u00FFK\u00DF>\u00F3oaB\x00 \x01\u0090jL\u008E\u00A8P\u00E6\x03\u00E8\x12\u0096\u009B\u00AC\u009Dl#\u00EC\u009F8V\u00B8\u00D81\u0082\u00DCR<*\u00BC\x06|f\u00FC\u00F6X7\x01O\u009C\u009F Y\u0088*L\x13\u0089\x11\u008D\x15\u008B\x13O\u0094H\u0091\u00CC\u00C0gJeJ\x1F\u00919*\u009B\u00BF\u00E3\u00B4\u00DC9\u00F9\n\u0085\x1A\u00C5\x1B;\u009B\u0094\u00BA\u0095\u0087T&U\u00D7\t\u00EC\u00EA\u00D2\x1A\u009A\u009A\u00EEZ)\u00DA\x15:}\u00BA\u009B\u00FA\u008A\x06$\u00C3s\u00BB\u00C6\u008D%M\u00A8\u00A6w\u00CD9\u0089\u00FB,n[\u00F1\u00ED\u00A6[\x0F\u00DA\u00AA\u00D9\x1D\u00B3\u00FF\u00E2h\u00EFT\u00B7\u0087\u00DB%\u00C2\u00B5\u00CF]\u00D4#\u00C2\u00F3\u00817\u00C6\u00C7\x7Fo\u008D\u00EFW?\u00A2\u00FF\u00D1\u0080\u00FE@n\u00B2\x13\u00E5D\u00D0\u00F3\x10\u00F6P3j\\X]\u00F8d$\x7F\u0094Et\x02\u00ED\u00FA\u00FE\u00B71\u00A8XB\u009C\x7F|^\u00C2\u00FD\u00C4\u00F9d\u00DE\x14\u00E3T\u00DA\u0081\u00F2\u00B4\u00EE\u00F4\u00B1\u008C\u00A9\u0083\u00B3\u0087\x16\x0E/g\u00AEd\u00ADgo\u00FD\u0085\u00CA\u00E1<\u00CA\u009B+\u0090'~L!_\u00B3\u00C0\u00F0\u00B8Y\u00A1\u00F5\u0089='=N\u00F9\u009C\u00F6;C.\u00A2\x16\u0087\u0097\u0084\u009F\u00A5\u009E\u00A3\u0096\u0086\u0095\u0085\u009E'\u0095\u00FBT\u00B8^\u00B0\u00AB4\u00BD\u00A8~I\u00B1J\u00BEz\u00C7e\u00E9\x1A\u00FC\x15\u00F1\u00AB\u00C2\u00D7\x04\u00AE\u00F3\u00D6\u00F2\u00D4q\u00DE`\u00BE\u00F1\u00EB\u00E6f\u00FD\u00EA\u00AD\u00C5\u00DB\u00B3\r\u00A3w\x06\x1B\u009F\u00DE\u00EDjjn\u00AEo\u00B9~\u00EF\u00CA\u00FD\x0B\u00ADg\x1E\u00E4\u00B7\x1Dm\u00CF\u00EC8\u00D8\u0099\u00DCE\x7F\x18\u00F5(\u00EAqD7\u00A9\u0087\u00D8\u008B\u00EB\u009D\u00EA\u00BB\u00F5$\u00FD\u00A9m\u00BF`\u00FF\u00DC\u00B3\u0086\u00E7\u0099\x03.\u0083\u0092\u0083\u008B/\u00DA_\x16\u00BE\u00F2\x1FR\x19\u00FA\u00FE\u00FA\u00C9p\u00D1\b\u00E9\u008D\u00CA\u009Boo\x1F\u008F\x16\u008Cy\u008C\u008B\u008F\u00CFL\u00D4\u00FEM\x7F\u00A7\u00F3\u00EE\u00DBd\u00CBT\u00CA\u00B4\u00C1\u00F4\u00FAL\u00E3l\u00EA\u009C\u00D9{\u00A6\u00F7\u00BD\u00F3y\x1F\x1C?\u00F2||\u00F9\u00A9h\u00C1kQhqd\u00A9\u00F8\u00B3\u00D7\u00B2\u00D0\u00F2\u00D0\u0097\u00C2\x15\u00C7U\u00AE\u00D5\u00DE\u00AF\u0099kfk\u008C\u00F5\x07\x1B\u00C9\u009B\u00DA\u009B\u00CB\u00DFj\u00BF\u0087\u00FFP\u00FC1\u00F7\u00B3r+\u00E0\u0097\u00E4\u00AF\u00B7\u008C\u00FD\f\x06\x00\x12\u00C5\u00C4\u0087\u00C21c\u00D1\x02,\u00DC\u00AC\x1Cl\u00ACl[\u00EC\u00DF8>s\u00CEp\u00BD\u00C1\u00F4sw\u00F0\u00D4\u00F3V\u00F2\u009D\u00E2\u00CF\u00C2&\b\u0084\u00E3\u00F6\t:\t\x11\u0085\u00F5EtD\u0095\u00C5\u00D4\u00C4U%t$\u008D\u00F1\u0096R&\u00D2z2*\u00B2\u00CA;\u0094\u00E5v\u00CA\x13\x14\u0094\x15\t;u\u0094\u0088\u00CA\u00B6*^\u00AAT\u00B5$B\u008Ez\u0099F\u00A3\u00E6s\u00AD%\x1D^]-=W\u00FDd\u0083\u00CB\u0086\u00C3F\u00AC\u00C6\u00DA&\u00FBMk\u00CD\u00E6\u0089J\x16\u00E1\u00967\u00AC6\u00AD-mrmG\u00EC\u00D5\x1DR\x1D\x07\u009DE\u00F7\u0084\u00B84\u00BA!\u00DC\x1D<Nx\u008Ey+\u00FA\u00D0\u00F6\u00DE\u00F2\u00DD\u00F0\u00D3\u00F3?\x10\u00D0F\u00DA\"\x1BR\u00E2\u0083\u00EE\x06\u00AF\u0086\u00AAR\u00C3\u00C2\u00AE\u0086\x7F\u008C\u0094\u008B\u00F2\u008D.\u00A6\u00BD\u00A6\u00F3\u00C7\u00B8\u00C5\x16\u00C6\u00F5%\u00B0&\u00DA'\u00E5'?J\u0099N\u00FDt\u00E0s\u00DAZ\u00FA\u00B7\u008C\u00EF\x07\x7F\x1Df\u00CE\u00E4\u00CC\u00E2\u00CF\x16>\"\u00FE\u0097l\x0E\u00E1\u00A8A\u00AEy\u009E\u00CD1\u00A7|\u00AF\x02\u00DF\u00E3\x01\u0085\u0094\x13a'\u00A3O\u00D1N\u00D3\u00CFD\x17E\x15\u00D3J\"\u00CF\x06\u009F\x0B(\u00F5*s>oY\u00AES\u00A1rA\u00A5R\u00F9\u00A2\u00E2%\u00C5*\u0085j\u00B9\u00CB\u00B252Wd\u00AF\u00CA\\\u0093\u00BC.V+R'|C\u00E8\u00A6@=\u00DF-\u00EE\u00DB\u00DC\r\u0098;\\\u008D\\wy\u009Bp\u00CDB-B\u00F7D\u00EF\u00E3[\u00E5\x1F\u00A8\u00B6i\u00B7\u00EBw\u0098w:v\u00F9<\u00DC\u00FBh\u00F7c\u00FC\u00E3\u0095\u00EE\u00DE\u009E\u00D2\u00DE\u00C8>\u00B3'\u0082O\x16\u009F>\u00EA/y\x16\u00F9\u009C8 >\u00B0>\u00D8\u00FF\u00A2\u00F2e\u00C2+\u00C7!\u00E9\u00A1\u00B5\u00D7\u00BD\u00C3\u00A5#\u00D1o\u00CC\u00DE\u00F2\u00BE\x1D\x1F\u00BD>\u0096:n=\u00C1;1\u00FAw\u00E5\u00BB\u00B0I\u00D5\u00C9\u00E5\u00A9\u00A6\u00E9\u00E33\u00A1\u00B3&s\u0082s\u008B\u00EF\x1F\u00CE\u0097|\u0088\u00FAh\u00F9I\u00F8\u00D3\u00C7\u0085\u00FB\u008B\u00C7\u0096\u00F6}V\u00FD\u00FCc\u00B9\u00FB\u00CB\u0089\x15\u00BFU\u00C5\u00D5\u0095\u00AF\u00F7\u00D6\u00B2\u00D7\u009D7\u00846\u00C66+\u00BFQ\u00BF\x13\u00BEo\u00FE\u00B8\u00FF3c\u00CB\u00F2\x17\u00E6\u00D7sF\u00E4v\u00FF\u0091\x1BL\u00CB\u00A8\u00AF\u00CC\u009F\u00D1\u008B,\u008B\u00AC\u008Bl\x13\u00EC\u00A3\x1C\u00AF8\u009Fp\u00B5b\u00EA\u00B8\u00CByry\x13\u00F8(\u00FC\u00F6X\u0082\x00\u00B7\u00C0*nP\u00F0\u009AP\u00A6\u00B0\u00AF\bA\u0094YtX\u00ACJ<N\u00C2R\u0092[r\x1C_%\x15)m \u0083\u0096y-{eG\u009A\u009C\u00BB\u00BC\u00B2\x02\u00AB\u00C2{\u00C5\u00EE\u009D5J\u00C7\u0094cU\u00F6\u00AA\u009A\u00AB\u00A9\x12\u00C4\u00D4\u00D9\u00D474f5\x07\u00B5\u00DA\u00B5o\u00EA\u0094\u00E9\u00E6\u00E8\u00C5\u00EB\u0093\f\u00EC\rw\u00ED\u00C2\x1B\u00A1\u008D\u0096\u008D\u0087L\u00EE\u0098\u009E4\u008B7\u00A7\x12=-\u00AC,\u00F5\u00AC\u00E4v\x0BY3[\u00AF\u00DB|\u00B0}c\u00D7c\u00DF\u00E8P\u00EDX\u00EC\u0094\u00E3\u009C\u00B8'\u00C4\u00C5\u00C3\u00D5\u00DE\u00CD\u00D0]\u00D9C\u00D2\x13\u00E7\u00C5\u00E5\u008D\u00F4\u00FE\u00EA\u00F3a\u00EF\u0094\u00EF\u00DB}\u00AF\u00FC\u00FA\u00FD\u00BB\x02\x1E\u0090Z\x03[\u00C8\u00B7(\x17\u0083r\u0082\u00E9!\u00FE\u00A1\u00D6T\u00B50\u0091p\u0096\u00F0\u00B5\u0088\u0099\u00C8\u00C1\u00A8\x07\u00D1u\u00B4\u00CA\u00FDg\u00E8\x7F\u00C5$\u00C6\u0086\u00C6\u00F9\u00C5;&\x18'\u00AA%I%cSP)\u00AB\u00A9\u00EF\x0E<K{\u0090~-\u00E3\u00D4\u00C1\u00F4C\u00C1\u0087\u009D2\u00B5\u00B2p\u00D9\u0088\u00EC\u008D#\u008B\x7FM\u00E7\u00BC=:\u0090\u00DB\u009D\u00D7r\u00ECF~MA\u00E9\u00F1\u00DC\u00C2\u00F4\x13\u00B4\u0093\u0094S\u00EE\u00A7\u00AD\u00CEh\x15\u00C9\x16\x0B\u00940\u0097|=;{n\u00A4\u00B4\u00BF\u00EC\u00C1\u00F9\u00EB\u00E5e\x15'/dU\u00A6^\u008C\u00BED\u00AA\u00F2\u00AC\u00DEs\u00D9\u00A6\u00C6\u00F0\u008A\u00F4U\u00B8:v\u00ED\u00FE\u00F5\u00E2Zz\u009D\u00D3\r\u00D5\u009B\u0098\u009BK\u00F5\u00FD\u00B7\u00AE\u00DC\u00CEm\u0088\u00BE\u00E3\u00DA\u00A8}\x17ww\u00A3i\u00AC\u00B9\u00B5\u00A5\u00EC^\u00DA}R+\u00F1\u00C1\u008E6\u00E6\u00B6\u00E9\u00F6\u00AE\u008E\u00EA\u00CE\u00CC.\u00D2C\u00A3G\"\u008F\u00D6\x1F\x0FtW\u00F5\u00E4\u00F6\u0096\u00F6u<\u0099z\u00CAx&\u00F2\\\x7F\u00C0g0\u00F5E\u00E9\u00CB\u009EW\u008B\u00AF\u00C5\u0086\u009DFr\u00DF<\x1D\u00E5\x1F\x0B\x18o\u00FE\u009B\u00FF]\u00FA\u00E4\u00D7\u00E9\u0083\u00B3\u0098\u00B9\u00CB\u00F3\u00CE\x1Fy?\u00BD^\u00AC\u00FB|\u00E6K\u00E1j\u00D9Z\u00FD\u00C6\u00DCw\u00FC\u00CF\u0080_i\f\x06\u00C0\u00F6\u00EC\x03\x00@\u00EB\x00\x14\u00C7\x01xM\x02\u00B8T\x01\x14l\x01(p\x02\u00E0j\x00\u009C\u00B9\x00\u00DC\u00F4\x01\u00D1Y\x00\u0088kY\u00800/\u00F8g~\x00\x00\x12X\u0081\x17$@\x05L\u00C0\r\" \x1B.\u00C2C\u0098E\u00B0#4\x10\u00BE\u0088\u00BF\x10M\u0088\x0FHq\u00A4;2\x1F\u00D9\u00C7\u00C4\u00CAd\u00CD\u0094\u00CB4\u0088\x12AQP\u00F5(\x06\u00B3\x13\u00F3E\u00E6ohg\u00F4U\x16\x14\x0B\u0089\u00A5\u009DU\u008A\u00F50\u00EB<\u009B\x03[=\u00BB\b{&\u00FB\x02\u0087'G'\u00A7\x06g\x19\x17\x0BW\x1C\u00D7\x14\u00C6\t\u00D3\u00CA\u00AD\u00C4]\u00CC\u00C3\u00C2\x13\u00C33\u00C9\u00EB\u00CC\u00DB\u00CA\u00A7\u00C4W\u00CC\u00CF\u00CC\x1F\u00C7?\u008Bu\u00C5v\b\x10\x04*p|\u00B8,\u00DC7\u00C1\b\u00C1wB\u00DEB\u00CF\u0085w\x0B\u00B7\u008B\u00EC\x12i\x14\u00D5\x11m\x113\x16\u00EB\x14\u00B7\x16\x1F\u0090\u00F0\u0092\u0098\u0095\u00A4K2\u00F0yR\x12R\u00B7\u00A5m\u00A4'eRd\u00B1\u00B2\u00F5;\u009Cw\u00AC\u00C8\x15\u00C9\x1B\u00CBO+\u00E4)\u00EA+\u00CE\u00ED<\u00ADd\u00A1\u00B4\u00AA\\\u00AD\u00E2\u00A7*\u00A4:\u00A0\u0096C\u00B0T\x07\u00F5V\u008DtMs-&\u00ADN\u00ED,\x1D{]\t=\u00A4\u00DE\u0092\u00FE\u00B0A\u00A7\u00E1\u00ED]UF\u00A7\u008C\u00B3L\x12L\u00C3\u00CC\u00C8\u00E6\u00FB\u0088\u00AE\x16\u00D6\u0096\u00E6V&\u00BBM\u00ADMmLmw\u00DB9\u00DB\u00FB8\x049\u00D2\u009C\x0E;\x17\u00ED\u00A9w\u00E9u\u009DtGx\u00C8{:x%xW\u00FA\f\u00FBr\u00EF3\u00F0#\u00FB\u009F\n\u00E8$\u00AD\u0092\u00E5)~AE\u00C1\u00FD\u00A1h\u00EA\u00EE\u00B0\u009C\u00F0\u00FEH\u009E(\u008F\u00E8\n\u00DAg\u00BAYLn\u00EC\u00DF\u00F1Z\t9\u0089c\u00C9*)GR\u00E7\u00D3,\u00D2\u00CB2~\x1C\u00F28\u00DC\u009C%\u0099\u009Dv\u00E4m\u008E\u00C9\u00D1;y\u00BE\u00F9b\x05C\u0085%'\x03O\u00CB\u009C\u00F9X\\w6\u00AD\u00D4\u00E1<\x7F\u00F9\u00E4\u0085\u00C6\u008B\u0085U\u0094\u00CB\u00D6WT\u00AFa\u00AF\u00FF\u00A8[\u00BA\u00F9\u00FE\u00D6L\u00C3D\u00E3|\u00D3\u00DA=\u00CEV\u00996\u00C7\u008E\u00E8\u00AE\u00F4G\x15\u00DD-\u00BD\x13OY\u009E\x11\x06\u00BC^\x1C\x7F\u00D53\u008C~C\x1C\u00CD\x1D\x1F{'7\u0095:3\u00F4~\u00E7\u0087\x03\u009F\u00A6\u0097l\u0097\u00AF\u00ACr\u00AC\u00C5l\u00CC|\u00B7\u00FAy\u009F\u00C1\u00D8\u00FEI\x00;\b\u0080,\u00E8\u0080=\x04\u00C1A\u00B8\x00]\u00F0\x01\u00C1\u00870FD\"\u00CA\x11CH.\u00A452\x1B\u00F9\u0098\u0089\u008D\u00C9\u0089\u00A9\u0088i\x12\u00A5\u0084JFu3\x0B1\u00872\u00B7\u00A01h*\u00BA\u009BE\u0091%\u0087\u00E5\x13\u00AB3k\x03\u009B\x04\u00DB\x11\u00B6/\u00EC>\u00EC=\x1C\u00DA\x1C\u0095\u009C|\u009C\u00879\u00D7\u00B9B\u00B8\u00DEb\u009C0\x1D\u00DC\u00DA\u00DCWydx\u00CE\u00F2\u00F2\u00F0\x1E\u00E1\u00FD\u00C5\x17\u00CF\u00B7\u00C2O\u00E5\u009F\u00C4\u00EE\u00C5\u00BE\x16p\x14\u00E8\u00C3Y\u00E1:\x04\u008D\x04\u009B\u0084t\u0085\u00EE\nk\n\u00D7\u0089\u00A8\u008B\u00DC\x10U\x17m\x123\x16\u00EB\x12\u00B7\x13\x1F\u0092\u00F0\u0097X\u0092L\u00C5\u00B3\u00E1\u008B\u00A5vJ\u00B5K\u00BBK/\u00C8d\u00CBJ\u00C86\u00EF\u00F0\u00D8\u00B1.W$o(?\u00AA\u0090\u00A1(\u00AF\u00F8|g\u00A2\x12^\u00A9G9FEJ\u00E5\u0095j\u00A6\u009A\u00A6\u00DA\f\u00A1H\u00DDZ}K\u00A3Q3JKVkD\u00FB\u00B8\u008E\u0083.Nw]oJ\u00FF\u0089A\u00A3\u00E1\u00E5]g\u008Dr\u008C\u0093M\"L\u00FD\u00CD<\u00CD\u00F7\x10\u00AD-\u008C,u\u00AD\u00B4vkY\u00EB\u00D8h\u00DB\x1A\u00D9Y\u00D9;;\u00F88\x06;%9\u00E7\u00ED\u00A9vis\x1Dv\u00DB\u00F0\x10\u00F74\u00F7\u008A\u00F4.\u00F6y\u00EA\u00CB\u00BC\u008F\u00E0\u00E7\u00E9\x7F$\u00A0\u00814E\u00C6R\u00AC\u0083\u00D2\u0082\u00EBC\u00E6\u00A82a\u00A4\u00F0\u00F2\u0088\u0089(\u00B1h\x7FZ\u00D5\u00FE\u00A5\x18\u008D\u00D8\u00A4\u00B8\u0087\t\u0098D\u008F\u00A4\u00D2\u00E4\u00D9T\u009D\x03\u00D9i/2$\x0FF\x1Cj\u00CE\u00E4\u00CA\"e\u00D7\x1D\u00F9\u009E\u00E3p\u00F4V\u009E\u00CD\u00B1\u00AD\u0082\u009AB\u00BF\u0093\u00C2\u00A7\u009E\u009E9\\\u00AC[\u00B2v\u00AE\u00B1,\u00AA\\\u00A1b\u00BE\u00F2\u00E6\u00A5\u0084j\u00D3\x1A\u00FE+\u00EF\u00AF\u00DD\u00AF=}#\u00BE>\u00F0\u00B6\u00DD\x1D\u009D\u00BB\u00EA\u00CD\u00AA\u00F7\u00B4Z\u008D\u00DA\u00BC:(]f\u008F\u00D4\u00BBEz9\u00FB\u00B6\u009En>[\x1A\u00F8\u00F0\u00E2\u00EB\u00AB\u009F\u00C3\x1CoDF\u00B5\u00C6=\u00FFN\u0099\u00AC\u009C~9\u0087\u009A\u00D7\u00FA\x18\u00BE\u00D0\u00B0\u00B4\u00F1\u00C5h\u00F5\u00E0\u00DA\u008BM\u00C5\u00EF\u00F4\u009F\u00AF\u00FE\u00F4\u009F\x03\x04A\x0E\u00F4\u00C1\tB!\x13\u00AA\u00A0\x1B\x16\x118\x04\x11\x11\u0083\u00A8FL \x05\u0091\u00EE\u00C8\"\u00E4\x04\u0093\x1CS,\u00D3c\u0094\x18*\x015\u00C4\u00AC\u00C7\\\u0081fG\u00A7\u00A0\x17YBY\u00A6X\x03X'\u00D8\u00F6\u00B1M\u00B0\x07\u00B2\u00CFrP9\u00969\x138\x19\\9\x18\x1C\u00A6\u0092[\u008D\u00BB\u008Dg\x0F\u00CF,\u00EF\x01>,_\x1D\u00BF\x03\u00FF\"\u00B6P@W`\f\u0097'\u00B8KpA\u00E8\u0092p\u00A0\u0088\u00AC\u00C8\u0090h\u00BE\u0098\u00B58B\u00BC]\"M\u00D2\x1C\u008F\u00C2wK\x1D\u0097\u00DE+\u00A3 \u00B3&\u00DB\u00B5\u00E3\u008C\\\u00B8<Q\x01\u00A7\u00F0E\u00F1\u00E9\u00CE\u00CBJ\x07\u0095}U\u008CU\u00A5\u00D5\u0098\u00D4f\t\u00BD\u00EA\u00B5\x1AE\u009A\x07\u00B5\u0082\u00B5\x1Duv\u00E9\u00AA\u00EB\u00E9\u00EA\x1B\x19\u0098\x1A\u00DA\u00EC\u00F24\"\x19\u0087\u009B\u00C4\u009B\x1E6;m~\u0099x\u00DB\u00A2\u00D3r\u00C8\u00EA\u00935\u00CAF\u00C8V\u00DB\u00CE\u00CD>\u00C6\u00E1\u0084c\u0083\u00D3\u00E8\x1E\u00B4\u008B\u0096\u00AB\u00BF[\u0081{\u00AF'\u00C2\u00CB\u00CC;\u00DD\u00A7\u00DBW`\u009F\u00BD_\u009A\x7FS\u00C0R\u00A0\"\u0099B\u00A9\x0E\u009A\x0F\u0091\x0B\u008D\u00A0\u00B6\u0084\u00A3\"\u00DC\"/D}\u00A5\u00D9\u00ED\u00AF\u00A63b\u00BD\u00E3\u009A\x13\u0084\x13\x13\u0092^\u00A4h\u00A5\u0096\u00A7\u00A1\u00D3C3\x06\x0Ei\x1D.\u00CF\u00C2d\u00C7\x1F\x19\u00CD\u00D9}\u00B4#\u00CF\u00E3\u00D8FAa\u00A1\u00E6\u0089\u00F1S\u00E9g\u00A4\u008B\x1E\u0095\u0084\u009F\x13-\u00ED8O\u00AE\u00E0\u00B8\u00D0|1\u00AC\n[\u00DDS\u0093qU\u00E7\u00DABm\u00D5\rJ\u00BD\u00E2\u00AD\u00A5\u0086\u00DA\u00C6\u00A4&\u00BB\x16\u0089{+\u00AD\u00CF\u00DA\u00EEv$u\u00CE?t|t\u00BF\u009B\u00D0s\u00B5O\u00E2\u00C9\u00C9~\u00F4\u00B3\u00A4\u00E7\u00AB\u0083\u00DE/\u009E\u00BD\u00D2\x1B*\x1F\u0086\x11\u00EF77GQc\u00EE\u00E3\u00E7'&\u00DE\u00C9N\u00FAN\x1D\u009B\u00BE732\u00BB\u00F6\x1E;\u00AF\u00F4\u00C1\u00F4\u00A3\u00E3'\u0097\x05\u00A7E\u0087%\u00DB\u00CF&\u00CB\x1A_\u00F0+\u00EC+\u009FW\x07\u00BF\u00D6\u00AD\u00E5\u00ADS7\u00CC7y6'\u00BE]\u00FF\u009E\u00FC\u00C3\u00E6\u00A7\u00E0\u00CF\u00F1\u00AD\u00B2_]\f\x06\u00C0\u00F6\u00BE\x04\x00\x00\u00EC\u00C4\u00E8\u0088h:\u00DE\u009Eh\x01\u00FF\u00BF\x12\x19\x11\u00F7\x0F\x07\x0F\x00pRcm\u00DC\x00\x00\x0B\x00\x03\u00C1t+\x17\x000\x07\u0080\u0099\u00A8@G'\x00\u00E0\x03@\u00C8\x05\u00C5X\u00BA\u00FE\u00C6z\u00C1T+\u009B\u00EDX\u0084--\u00D6\u00D9\r\x00\u0084\x00\x10>\u00C9\u00A1n\u009E\x00\u0080\x01@\u00D0\u00C3H\u00B6\u00CE\u00BFqFT\u0084\u00A3=\x00\u00E0\x00\x10\u00F9\u0094 \x0B\u00CB\u00DF\u00B1\u0097\u00E8q.\u00EE\x00 \x0B\u0080h\b\u008F\u00B6s\x01\x00N\x00\u00C4HP\u0094\u00FB?\\31\u00F1\u00AE\u00FF\u00F8\u00AFSH\x16v\x00 \x06\u0080D'\u0087\x12\x1D\u00B7\u00FD\u0091\u00D2`\x0FD\u00B0\x00<\u0090!\x1A\" \x1A\u00E8@\u0085^ \x03\x1DH\x10\x05xx\x07x \x03\x1D\u00A8\x10\x03\u00B1@\u00828H\x04<D\x00\x15\u00F6C\x1CP\u0081\x02A\x10\u00F3;>\x0E\" \b\u00E2\u0080\x0EV@\x02:\u0084@\x10\u00A8\u00FCf\u00F8\u00EF<\x1E0\x03t\u00A0\u00FE/\x1ET\u00A0@\u00B4?\u00F5\x10=\u00F2Vp|qt\u0092\u0081G(\u00E1\x1A\u00E1\x03\u00E1'\u00E0\x7F{\u00DB\u00FDa\f\u0082\u00A8?\u0099\u00B6\u00D9\x03\u00FF\u00D1Qr(\r\u00946\u00CA\x1Ce\u00842F\u00E9\x03\x1E\u0085C\u0089\u0080\nJ\x0B\u00A5\u00872C\u0099\u00A0\fQ\u00DA(\u00FDg\x0Bw\x17\u00FEd%\u00FE\u00A9\x00\u00FF'\u00E3\f\u00D0!\u00E4?jU\u0081` \x01\x1D\u00E2!\bb \x1C\u00E6\u0080\x0E\u0091\u00FE\u00D4C\u00FF\u00C6\u00C1\u00F6\u00AE\x0E\x00\u0080\u00E6\x01(\r\x00\x00h\u00DBL\u00C9\u00F8\u00CFw\x15\x1B\u0094\x18\x0B\x00@\u008C\u00A6%\u00D1\u00A9!\u00A1\u00B1x3\x1A-\"\bO\u008C\u008E\u00A4\u00C5\u00C5\x06\u00D1\u0095\u00F16QdUe\u00BC\x06\u0081\u00A0\r\x00\u00F0_\x14\u00F7T\u00A9\u00D4J\u008B\u00F2\x00\x00\x00 cHRM\x00\x00m\u0098\x00\x00s\u008E\x00\x00\u00E2\u00F9\x00\x00\u0086\u0099\x00\x00x\u0083\x00\x00\u00D4N\x00\x003\u00BC\x00\x00\x1Cyc\u00E1\x1F,\x00\x00\x00\u00A2IDATx\u00DA\u0094\u0091\u00B1\r\u00840\x10\x04\u00C7>\x07\u00D0\n=P\x07\x05\u0090\"\u008AA\u00A4\u00D4@\x05n\u00C3]\\\u008C\x03l\x7F\u00F0\x12\u00C9\x0B\u00F0_x\u00BA\u00DB\u00DD\u00D1\x1AU-)%D\x04\x11!\u00E7L)\u0085\u00DAq\x00\"\u0082\u00B5\u0096\u0094\u00D2\u00CF\u00C14M\u00B7\u00CF\u00EB\u00BAbT\u00B5\x18cn]\u009B\u00A6\u00B9\x15\u00881~\x13<E\u008E1\u00BE#\u00EC\u00FB\u008E\u00F7\u00FEZ\u00F6}\u00CF0\f\u00F5\b\u00CE9\u0096e!\u0084@\u00D7u\u00CC\u00F3\u00CCy\u009EU\bFU\x0B@\u00CE\u0099m\u00DB\x18\u00C7\x11kmu\x0B\u0097\x00@\u00DB\u00B6\x1C\u00C7\u00F1\x7F\x0BO\x0Eo\b\u009F\x01\x00\u009B\u00FDU\u00A2t\u00A1Hz\x00\x00\x00\x00IEND\u00AEB`\u0082"));
myFlyoutIcon.encoding = "BINARY";
myFlyoutIcon.open( "w" );
myFlyoutIcon.write( binData );
myFlyoutIcon.close();
} // the above code to create the file should only execute once for each user on the machine
palette._flyoutMenu = {}; // this object will hold the menu related stuff - prefaced with an underscore to avoid naming collisions
palette._flyoutMenu.items = menuItems;
palette._flyoutMenu.callback = callback;
palette._flyoutMenu.draw = function( palette ) { // actually draw the menu
// add the dropdownlist object to the window
palette._flyout = palette.add( "dropdownlist", [ ( palette.frameSize.width - 20 ), 0, palette.frameSize.width, 20], palette._flyoutMenu.items );
// make sure nothing is selected
palette._flyout.selection = null;
// add the onDraw method that will draw the icon instead of the normal dropdownlist
palette._flyout.onDraw = function() {
this.graphics.drawImage( ScriptUI.newImage( myFlyoutIcon ), 0, 0 );
}
// add the onChange method to fire off the callback
palette._flyout.onChange = function() {
this.window._flyoutMenu.callback( this.selection );
this.selection = null;
}
}
// execute the draw function to place the flyout in the window
palette._flyoutMenu.draw( palette );
}
// sample usage
// create the menu items
var menuItems = [ "One", "Two", "Three", "-", "Four", "Five" ];
// create the callback function
sampleCallback = function( selection ) {
// just letting all the menu items fall through for this demo
switch( selection.text ) {
case "One" :
case "Two" :
case "Three" :
case "Four" :
case "Five" : {
alert( selection.text );
}
}
}
// create the palette
var myPalette = new Window( "palette", "Fly Out Menu Demo" );
// adding some static text, just because
myPalette.add( "statictext", undefined, "Demonstration of using ScriptUI drawing to customize control appearance" );
//center and show the palette
myPalette.center();
myPalette.show();
// add the flyout menu
addFlyout( myPalette, menuItems, sampleCallback );
Hi Kasyan,
Regarding to the background color of the button, you get the same result as mine :
Error: Cannot set backgroundColor property for this element type
I can accept backroundColor is not a property of a button but why is it told as one of the properties in the scriptui model ? A mistery.
For you next error :
var pen = g.newPen( g.PenType.SOLID_COLOR, [0.7, 0.7, 0.7, 1] );
throws an error: TypeError: Bad argument list.
I buyed and use as a basis RapidUI. So I create my items on this soft, grab the code and modify them in ESTK.
Very weirdly, it generates this kind of argument for the color :
var pen = g.newPen( g.PenType.SOLID_COLOR, [0.7, 0.7, 0.7], 1 ); //-> [R,G,B],A
Meanwhile the scriptUI precises [R,G,B,A].
But [R,G,B,A] throws an error. [R,G,B],A runs but alpha seems to be ignored.
I can't tell why use once graphics and other time scriptUI. Let's hope We get some more detailed informations on ScriptUI styling (and ScriptUI in general) soon.
If it can help ?
Loic
A quick question :
I was able to place an image as a button background.
However I was concerned as the path to the image is an absolute path. What if we use the script in another environment where the image is not located ?
What becomes this image if we export the script for using it somewhere else ?
Loic
For 26 Euros (http://www.scriptui.com/) or 50 Euros (http://www.scriptuibuilder.com/) you could save yourselves a lot of time!
Peter
Hi Peter,
I buyed and use pleasantly Rapid ScriptUI. It's clearly a great help.
However some behaviours disturb me. If you switch a color of a item, the dialog sometimes disappear but I can't tell if it's connected to rapiUI or Adobe ScriptUI errors.
I don't use http://www.scriptuibuilder.com/ but would be glad to hear comments on it.
Loic
Thank you for your example, Bob.
However I was concerned as the path to the image is an absolute path. What if we use the script in another environment where the image is not located ?
Loic,
Take a look at these lines:
if ( !myFlyoutIcon.exists ) { // if it's not there, then create the file
var binData = (new String("\u0089PNG\r\n\x1A\n\x00\x00 ...
If the image file doesn't exist in the user data folder, it will be created by reading binary data right from the script — the image (binary data) is 'hidden' inside the script (text data). Very elegant!
Kasyan
A quick question :
I was able to place an image as a button background.
However I was concerned as the path to the image is an absolute path. What if we use the script in another environment where the image is not located ?
I use Dave Saunders function to get path to current script file folder (allows debugging)
function getScriptFolder(){
try {
var activeScript = File(app.activeScript);
} catch(e) {
// running from ESTK ...
var activeScript = File(e.fileName);
}
return activeScript.parent;
}
and reference to it
getScriptFolder() + "\\mypic.png"
Loic_aigon wrote:
I buyed and use pleasantly Rapid ScriptUI. It's clearly a great help.
However some behaviours disturb me. If you switch a color of a item, the dialog sometimes disappear but I can't tell if it's connected to rapiUI or Adobe ScriptUI errors.
Sorry to hear about this issue, please see if you can duplicate and contact us at http://scriptui.com/contact.aspx
Steven
www.scriptui.com
If you just accept that the background color property is readonly and meant for your reference, it becomes pretty easy.
Extending the example of above, this works for me:
var dlg = new Window('dialog', 'Test');
var pnl = dlg.add('panel', undefined, 'My Panel');
var btn = pnl.add('button', undefined, 'My Button', {name:'ok'});
var btn2 = pnl.add('iconbutton', undefined, undefined, {name:'orange', style: 'toolbutton'});
btn2.size = [100,20];
btn2.onDraw = function()
{ with( this ) {
try {
var orange = graphics.newBrush( g.BrushType.SOLID_COLOR, [1, 0.7, 0, 1] );
graphics.newPath();
graphics.rectPath(0,0,bounds[2]-bounds[0],bounds[3]-bounds[1]);
graphics.fillPath(orange);
} catch( ex ) {
$.writeln(ex);
}
}} // onDraw
dlg.show();
Sorry to follow up on my own post, but this one is even shorter.
function fillRect()
{ with( this ) {
graphics.rectPath(0,0,size[0],size[1]);
graphics.fillPath(fillBrush);
}}
var dlg = new Window('dialog', 'Test');
var pnl = dlg.add('panel', undefined, 'My Panel');
var btn = pnl.add('button', undefined, 'My Button', {name:'ok'});
var btn2 = pnl.add('iconbutton', undefined, undefined, {name:'orange', style: 'toolbutton'});
btn2.size = [100,20];
btn2.fillBrush = btn2.graphics.newBrush( g.BrushType.SOLID_COLOR, [1, 0.7, 0, 1] );
btn2.onDraw = fillRect;
dlg.show();
Dirk Becker wrote:
If you just accept that the background color property is readonly and meant for your reference, it becomes pretty easy.
Extending the example of above, this works for me:
var dlg = new Window('dialog', 'Test');
var pnl = dlg.add('panel', undefined, 'My Panel');
var btn = pnl.add('button', undefined, 'My Button', {name:'ok'});
var btn2 = pnl.add('iconbutton', undefined, undefined, {name:'orange', style: 'toolbutton'});
btn2.size = [100,20];
btn2.onDraw = function()
{ with( this ) {
try {
var orange = graphics.newBrush( g.BrushType.SOLID_COLOR, [1, 0.7, 0, 1] );
graphics.newPath();
graphics.rectPath(0,0,bounds[2]-bounds[0],bounds[3]-bounds[1]);
graphics.fillPath(orange);
} catch( ex ) {
$.writeln(ex);
}
}} // onDraw
dlg.show();
Cheers ;-)Dirk
The problem with using onDraw is that it makes it necessary to repaint the entire Button Including the click effect the text and the round edges of the button, since we are overriding the default drawing.
Correct me if I'm mistaken, but thats how it seems on Win xp CS4
Steven
Steve,
you're right if you want to recolor Apple's fancy, rounded, gradiented(?) and eventually pulsating Aqua buttons. For that, take a screen shot, recolor it in PhotoShop and draw an image! ScriptUI is a cross platform compromise anyway, I like the rectangular icon button because I need not go thru the headache to match curves. Furthermore, ScriptUIGraphics is missing a curveto() method.
Next version of the script below - it uses 0.5 alpha to let the original control shine thru.
Besides it fixes a bug where I fell victim to a global variable "g" that stayed around from earlier on - unlike InDesign the ESTK as target does not zap the main session after completion.
function fillRect()
{ with( this ) {
graphics.drawOSControl();
graphics.rectPath(0,0,size[0],size[1]);
graphics.fillPath(fillBrush);
}}
var dlg = new Window('dialog', 'Test');
var pnl = dlg.add('panel', undefined, 'My Panel');
var btn = pnl.add('button', undefined, 'My Button', {name:'ok'});
var btn2 = pnl.add('iconbutton', undefined, undefined, {name:'orange', style: 'toolbutton'});
btn2.size = [100,20];
btn2.fillBrush = btn2.graphics.newBrush( btn2.graphics.BrushType.SOLID_COLOR, [1, 0.7, 0, 0.5] );
btn2.onDraw = fillRect;
dlg.show();
Nice work Dirk,
The problem with icon buttons becomes apparent which you want them to
have some text. To get that to work, you need to stack three objects
like I've done here:
function namedButton (container,name,size,color){
color = color || [0.1, 0.4, 0.9, 0.3];
size = size || [100,20];
var grp = container.add('group');
grp.orientation = 'stack';
var btn = grp.add('iconbutton', undefined, undefined, {style:'toolbutton'});
btn.size = size;
grp.add('statictext',undefined,name);
btn.fillBrush=btn.graphics.newBrush( btn.graphics.BrushType.SOLID_COLOR, color );
btn.onDraw = function (){
this.graphics.drawOSControl();
this.graphics.rectPath(0,0,this.size[0],this.size[1]);
this.graphics.fillPath(this.fillBrush);
}
var clickButton = grp.add('iconbutton', undefined, undefined, {style:'toolbutton'});
clickButton.size = size;
clickButton.fillBrush=clickButton.graphics.newBrush( clickButton.graphics.BrushType.SOLID_COLOR,[0,0,0,0] );
clickButton.onDraw = function (){
//this.graphics.drawOSControl();
this.graphics.rectPath(0,0,this.size[0],this.size[1]);
this.graphics.fillPath(this.fillBrush);
}
return clickButton;
}
var dlg = new Window('dialog', 'Test');
var pnl = dlg.add('panel', undefined, 'My Panel');
var btn = pnl.add('button', undefined, 'Standard Button', {name:'ok'});
var btn2 = new namedButton(pnl,"Cool Button");
btn2.onClick = function(){
alert("Yep. This is cool!");
}
dlg.show();
Harbs
Innovations in Automation
Harbs. wrote:
Nice work Dirk,
The problem with icon buttons becomes apparent which you want them to
have some text.
I assume you mean if you want text when custom drawing the color, or on top of the color. Otherwise the Icon Button has no issue showing text to the side of the image using text property. (CS3?)
Steven
> To get that to work, you need to stack three objects like I've done here:
or add three lines, like I've done here ...
function customDraw()
{ with( this ) {
graphics.drawOSControl();
graphics.rectPath(0,0,size[0],size[1]);
graphics.fillPath(fillBrush);
if( text ) graphics.drawString(text,textPen,(size[0]-graphics.measureString (text,graphics.font,size[0])[0])/2,3,graphics.font);
}}
var dlg = new Window('dialog', 'Test');
var pnl = dlg.add('panel', undefined, 'My Panel');
var btn = pnl.add('button', undefined, 'My Button', {name:'ok'});
var btn2 = pnl.add('iconbutton', undefined, undefined, {name:'orange', style: 'toolbutton'});
btn2.size = [200,20];
btn2.fillBrush = btn2.graphics.newBrush( btn2.graphics.BrushType.SOLID_COLOR, [1, 0.7, 0, 0.5] );
btn2.text = "Hello, Harbs";
btn2.textPen = btn2.graphics.newPen (btn2.graphics.PenType.SOLID_COLOR,[0,0.5,0,1], 1);
btn2.onDraw = customDraw;
dlg.show();
C'mon Harbs you know I can't type code blind like you. OK here's a sample, only works with CS4
var rapidDlg = new Window('dialog',"Lets try",undefined);
buildWindow();
rapidDlg.show();
function buildWindow(){
// Properties for rapidDlg.IconButton1
rapidDlg.IconButton1 = rapidDlg.add('iconbutton',undefined,undefined);
rapidDlg.IconButton1.text = 'Works for me';
rapidDlg.IconButton1.onClick = function(){
alert('Hurray!');
}
rapidDlg.IconButton1.titleLayout = new Object ({alignment:['center','center']});
}
GS
Steven
Hi Steven,
Hmm. It looks like you are right that icon buttons have a text
property. The OMV does not list it.
I did try using the text property, but it doesn't work when you color
in the button using Dirks method (i.e. the fill covers over the text).
When coloring the button, I don't see how the text property would help.
Harbs
Innovations in Automation
Using onDraw overrides the default drawing of the button, but using image doesn't override the drawing of the text.
Here's an example using Bob Stucky's neat image trick. (image created in microsoft Paint to keep it small, since Photoshop inflates image with metadata etc.)
Place in folder which doesn't need permission to create file and orange.jpg will be created for it
var rapidDlg = new Window('dialog',"Orange Button",undefined);
buildWindow();
rapidDlg.show();
function buildWindow(){
// Properties for rapidDlg.IconButton1
createImage ();
rapidDlg.IconButton1 = rapidDlg.add('iconbutton',undefined,getScriptFolder() + "/orange.jpg");
rapidDlg.IconButton1.text = 'Orange';
rapidDlg.IconButton1.titleLayout = new Object ({alignment:['center','center']});
}
function createImage(){
var myImageFile = new File(getScriptFolder() + "/orange.jpg");
if(myImageFile.exists ==false|| myImageFile.constructor != File)
{
var binS = new String("\u00FF\u00D8\u00FF\u00E0\x00\x10JFIF\x00\x01\x01\x01\x00`\x00`\x00\x00\u00FF\u00E1\x00\x16Exif\x00\x00II*\x00\b\x00\x00\x00\x00\x00\x00\x00\x00\x00\u00FF\u00DB\x00C\x00\b\x06\x06\x07\x06\x05\b\x07\x07\x07\t\t\b\n\f\x14\r\f\x0B\x0B\f\x19\x12\x13\x0F\x14\x1D\x1A\x1F\x1E\x1D\x1A\x1C\x1C $.' \",#\x1C\x1C(7),01444\x1F'9=82<.342\u00FF\u00DB\x00C\x01\t\t\t\f\x0B\f\x18\r\r\x182!\x1C!22222222222222222222222222222222222222222222222222\u00FF\u00C0\x00\x11\b\x00\x14\x00d\x03\x01\"\x00\x02\x11\x01\x03\x11\x01\u00FF\u00C4\x00\x1F\x00\x00\x01\x05\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\b\t\n\x0B\u00FF\u00C4\x00\u00B5\x10\x00\x02\x01\x03\x03\x02\x04\x03\x05\x05\x04\x04\x00\x00\x01}\x01\x02\x03\x00\x04\x11\x05\x12!1A\x06\x13Qa\x07\"q\x142\u0081\u0091\u00A1\b#B\u00B1\u00C1\x15R\u00D1\u00F0$3br\u0082\t\n\x16\x17\x18\x19\x1A%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u00E1\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00F1\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FF\u00C4\x00\x1F\x01\x00\x03\x01\x01\x01\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\b\t\n\x0B\u00FF\u00C4\x00\u00B5\x11\x00\x02\x01\x02\x04\x04\x03\x04\x07\x05\x04\x04\x00\x01\x02w\x00\x01\x02\x03\x11\x04\x05!1\x06\x12AQ\x07aq\x13\"2\u0081\b\x14B\u0091\u00A1\u00B1\u00C1\t#3R\u00F0\x15br\u00D1\n\x16$4\u00E1%\u00F1\x17\x18\x19\x1A&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz\u0082\u0083\u0084\u0085\u0086\u0087\u0088\u0089\u008A\u0092\u0093\u0094\u0095\u0096\u0097\u0098\u0099\u009A\u00A2\u00A3\u00A4\u00A5\u00A6\u00A7\u00A8\u00A9\u00AA\u00B2\u00B3\u00B4\u00B5\u00B6\u00B7\u00B8\u00B9\u00BA\u00C2\u00C3\u00C4\u00C5\u00C6\u00C7\u00C8\u00C9\u00CA\u00D2\u00D3\u00D4\u00D5\u00D6\u00D7\u00D8\u00D9\u00DA\u00E2\u00E3\u00E4\u00E5\u00E6\u00E7\u00E8\u00E9\u00EA\u00F2\u00F3\u00F4\u00F5\u00F6\u00F7\u00F8\u00F9\u00FA\u00FF\u00DA\x00\f\x03\x01\x00\x02\x11\x03\x11\x00?\x00\u00D7\u00A2\u008A+\u00F33\u00F4 \u00A2\u008A(\x00\u00A2\u008A(\x00\u00A2\u008A(\x00\u00A2\u008A(\x00\u00A2\u008A(\x00\u00A2\u008A(\x00\u00A2\u008A(\x00\u00A2\u008A(\x00\u00A2\u008A(\x00\u00A2\u008A(\x00\u00A2\u008A(\x00\u00A2\u008A(\x00\u00A2\u008A(\x03\u00FF\u00D9");
myImageFile.open("w");
myImageFile.encoding = "BINARY";
myImageFile.write(binS);
myImageFile.close();
}
}
function getScriptFolder(){
try {
var activeScript = File(app.activeScript);
} catch(e) {
// running from ESTK ...
var activeScript = File(e.fileName);
}
return activeScript.parent;
}
One issue is that if default margin is left then there is a little border uncolored, however if margin is set to 0 then we lose the rounded edges unless they are part of the image.
I attached file of code since copying code from forum created new error in code, so just test with code from text file
Hi all,
I used with enjoyment, bob's script to encapsulate a png into a scriptui UI.
I wanted to let you know that I was reported an error on Windows7 environment meanwhile on any other systems, it always have perfectly worked.
Obviously, in this situation, the script didn't create the picture but understanding why is something out of my actual skills.
I thoght about a specific encoding but ain't have a W7 at hand for test.
Have any of you encountered such issue ?
Loic
Hi all,
maybe I totally missed the point you are discussing here... but why not using the example provided in the scriptUI tutorial by Peter Kahrel?
Does it do the thing you were looking for?
var w = new Window ("dialog");
var s = w.add ("statictext", undefined, "Static");
var e = w.add ("edittext", undefined, "Edit");
var b = w.add ("button", undefined, "Button");
// The window's backround
w.graphics.backgroundColor = w.graphics.newBrush (w.graphics.BrushType.SOLID_COLOR, [0.5, 0.0, 0.0]);
// Font and its colour for the first item, statictext
s.graphics.font = ScriptUI.newFont ("Helvetica", "Bold", 30);
s.graphics.foregroundColor = s.graphics.newPen (w.graphics.PenType.SOLID_COLOR, [0.7, 0.7, 0.7], 1);
// Font and colours for the second item, edittext
e.graphics.font = ScriptUI.newFont ("Letter Gothic Std", "Bold", 30);
e.graphics.foregroundColor = e.graphics.newPen (e.graphics.PenType.SOLID_COLOR, [1, 0, 0], 1);
e.graphics.backgroundColor = e.graphics.newBrush (e.graphics.BrushType.SOLID_COLOR, [0.5, 0.5, 0.5]);
// Font for the tird control, a button. Can't set colours in buttons
b.graphics.font = ScriptUI.newFont ("Minion Pro", "Italic", 30);
w.show ();
Hi guys,
As far as I am concerned, this problematic even has decided me to turn from scriptUI to ( what was then PatchPanel ) extensions. I still do ScriptUI once in a while but and it's really my humble opinion, I always found cumbersome to have so many lines of code for the simpliest UI behaviour. However I deeply admire how far Peter and Marc ( and a few others guy btw ) have pushed ScriptUI to the limits.
But I realise how troll-ish this post could be and I apologize for that. I just wanted to share my experience and how this colored button consideration affected my poit of view ![]()
Best to all,
Loic
Hi Peter,
As far as I am concerned too, Loïc is right in that Flex provides a huge collection of native and pre-built widgets and controls that would need a lot of code to be mimicked in ScriptUI: many kinds of buttons and containers, date controls, menus, repeaters, validators, formatters, effects, not to mention chart controls, advanced datagrids, media loaders and web-friendly components. There is no doubt that Flex-based UI is much easier to design. Cf. http://examples.adobe.com/flex3/componentexplorer/explorer.html
However—as you know—I'm still a big supporter of ScriptUI despite its Spartan side. Its main advantage is to be instantly available to ExtendScript programmers, it does not require JS-AS bridge(s), does not relies on a Flash player, and does not involve complicated bricks and libraries when you need to interact with the DOM from your UI, which after all is our main purpose. Last point: ScriptUI is part of the basic Creative Suite, while FlashBuilder + CS ExtensionBuilder are additional products.
My personal feeling is that Flash/Flex/ActionScript technologies in Adobe apps involve a high density of dependencies. As soon as we try to develop some advanced functionality, there are too many bricks to handle and connect, and too many constraints to be aware of. Dealing with both ActionScript, MXML, Flex compilation issues, CS ActionScript Wrapper Library (CSAWLib and/or csaw_indesign.swc), CS eXtensible Services (CSXSLibrary), and/or HostObject, and/or id_host_adapter, and/or ExternalInterface, and/or SWFLoader, etc., is simply too much for me, while my goal is just to make some “scripted plug-in” available to ID CS4/CS5/CS6 users. As I have a very limited memory, I just want to focus on the core of my project—which is basically to turn the InDesign DOM into a cultivated variety! ExtendScript-JS is an integrated module that offers all what I need and only what I need, including ScriptUI.
@+
Marc
North America
Europe, Middle East and Africa
Asia Pacific