Dialog box with check boxes in Photoshop CS6, javascript
Hi,
I need to create dialog box to allow user to pick from selection of check boxes in Photoshop CS6, javascript.
Thank you.
Yulia
Hi,
I need to create dialog box to allow user to pick from selection of check boxes in Photoshop CS6, javascript.
Thank you.
Yulia
Thank you, this is great. Will it allow the user to choose more than one color at the time?
Yulia
No this example is only one colour at a time.
This will let you use 3.
#target photoshop
app.bringToFront();
main();
function main(){
if(!documents.length) {
alert("No documents are open!");
return;
}
var win = new Window('dialog','Spot Channel');
win.orientation='column';
win.alignChildren = 'center';
win.pnl1 = win.add('panel',undefined,'Spot Channel', {borderStyle: 'black'} );
win.pnl1.alignChildren = 'left';
win.pnl1.rb1 = win.pnl1.add('checkbox',undefined,'Colour 1');
win.pnl1.rb1.value=true;
win.pnl1.rb2 = win.pnl1.add('checkbox',undefined,'Colour 2');
win.pnl1.rb3 = win.pnl1.add('checkbox',undefined,'Colour 3');
win.grp1 = win.add('group');
win.select = win.grp1.add('button',undefined,'Ok');
win.can = win.grp1.add('button',undefined,'Cancel');
win.select.preferredSize = win.can.preferredSize=[70,20];
win.select.onClick=function(){
win.close(0);
if(win.pnl1.rb1.value){
//Checkbox 1
var theColor = new SolidColor();
theColor.cmyk.cyan = 50;
theColor.cmyk.magenta = 0;
theColor.cmyk.yellow = 0;
theColor.cmyk.black = 0;
var theCh = activeDocument.channels.add();
theCh.kind = ChannelType.SPOTCOLOR;
theCh.name = "test1";
theCh.opacity = 50;
theCh.color = theColor;
activeDocument.activeLayer.invert();
}
if(win.pnl1.rb2.value){
//Checkbox 2
var theColor = new SolidColor();
theColor.cmyk.cyan = 50;
theColor.cmyk.magenta = 0;
theColor.cmyk.yellow = 50;
theColor.cmyk.black = 0;
var theCh = activeDocument.channels.add();
theCh.kind = ChannelType.SPOTCOLOR;
theCh.name = "test2";
theCh.opacity = 50;
theCh.color = theColor;
activeDocument.activeLayer.invert();
}
if(win.pnl1.rb3.value){
//Checkbox 3
var theColor = new SolidColor();
theColor.cmyk.cyan = 50;
theColor.cmyk.magenta = 50;
theColor.cmyk.yellow = 0;
theColor.cmyk.black = 0;
var theCh = activeDocument.channels.add();
theCh.kind = ChannelType.SPOTCOLOR;
theCh.name = "test3";
theCh.opacity = 50;
theCh.color = theColor;
activeDocument.activeLayer.invert();
}
}
win.center();
win.show();
}
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.