Photoshop2019でカラーパレットを表示させる自作jsxスクリプトが実行できない
Q&A
Closed
解決したいこと
下記のjsxスクリプトをAdobe Photoshop 2019 & 2021 & 2022で実行するとエラーダイアログが表示され、スクリプトが実行できずに停止してしまいます。
このスクリプトを上記のバージョンで実行できるように修正したいです。
どなたか解決方法を教えて頂ければと思います。
動作環境 Windows10、Adobe Photoshop 2019
発生している問題・エラー
エラー41: は範囲外です.
ライン200
->
button1.fillBrush = button1.graphics.newBrush( button1.graphics.BrushType.SOLID_COLOR, [bArray[1]/255,bArray[2]/255,bArray[3]/255,1] );
または、問題・エラーが起きている画像をここにドラッグアンドドロップ
※正常に実行されると下記のメニューが表示されます(Photoshop 2020だと正常に実行されます)
該当するソースコード(言語 : JavaScript XML)
var fColor= app.foregroundColor;
var bColorLog=File('~/Desktop/bColorLog.txt');
var bColor=bColorLog.open('r');
if(bColor==false){
var bColorLog= new File('~/Desktop/bColorLog.txt');
bColorLog.open('w');
bColorLog.write('1,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135')
var bColor=bColorLog.open('r');
}
var bC=bColorLog.read();
var bArray=bC.split(',')
//123
if (bArray[0]==1){
var bArray=[1,fColor.rgb.red,fColor.rgb.green,fColor.rgb.blue,bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
var bColor=bColorLog.open('w');
bColorLog.write(bArray);
}
//456
if (bArray[0]==2){
var bArray=[2,bArray[1],bArray[2],bArray[3],fColor.rgb.red,fColor.rgb.green,fColor.rgb.blue,bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
var bColor=bColorLog.open('w');
bColorLog.write(bArray);
}
//789
if (bArray[0]==3){
var bArray=[3,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],fColor.rgb.red,fColor.rgb.green,fColor.rgb.blue,
bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
var bColor=bColorLog.open('w');
bColorLog.write(bArray);
}
//101112
if (bArray[0]==4){
var bArray=[4,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],bArray[8],bArray[9],
fColor.rgb.red,fColor.rgb.green,fColor.rgb.blue,bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
var bColor=bColorLog.open('w');
bColorLog.write(bArray);
}
//131415
if (bArray[0]==5){
var bArray=[5,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],bArray[8],bArray[9],
bArray[10],bArray[11],bArray[12],fColor.rgb.red,fColor.rgb.green,fColor.rgb.blue,bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
var bColor=bColorLog.open('w');
bColorLog.write(bArray);
}
//161718
if (bArray[0]==6){
var bArray=[6,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],fColor.rgb.red,fColor.rgb.green,fColor.rgb.blue,
bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
var bColor=bColorLog.open('w');
bColorLog.write(bArray);
}
//192021
if (bArray[0]==7){
var bArray=[7,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],fColor.rgb.red,fColor.rgb.green,fColor.rgb.blue,bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
var bColor=bColorLog.open('w');
bColorLog.write(bArray);
}
//222324
if (bArray[0]==8){
var bArray=[8,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],fColor.rgb.red,fColor.rgb.green,fColor.rgb.blue,bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
var bColor=bColorLog.open('w');
bColorLog.write(bArray);
}
//252627
if (bArray[0]==9){
var bArray=[9,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],fColor.rgb.red,fColor.rgb.green,fColor.rgb.blue,
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
var bColor=bColorLog.open('w');
bColorLog.write(bArray);
}
//282930
if (bArray[0]==10){
var bArray=[10,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
fColor.rgb.red,fColor.rgb.green,fColor.rgb.blue,bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
var bColor=bColorLog.open('w');
bColorLog.write(bArray);
}
//313233
if (bArray[0]==11){
var bArray=[11,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],fColor.rgb.red,fColor.rgb.green,fColor.rgb.blue,bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
var bColor=bColorLog.open('w');
bColorLog.write(bArray);
}
//343536
if (bArray[0]==12){
var bArray=[12,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],fColor.rgb.red,fColor.rgb.green,fColor.rgb.blue,bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
var bColor=bColorLog.open('w');
bColorLog.write(bArray);
}
//373839
if (bArray[0]==13){
var bArray=[13,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],fColor.rgb.red,
fColor.rgb.green,fColor.rgb.blue,bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
var bColor=bColorLog.open('w');
bColorLog.write(bArray);
}
//404142
if (bArray[0]==14){
var bArray=[14,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],fColor.rgb.red,fColor.rgb.green,fColor.rgb.blue,bArray[43],bArray[44],bArray[45]];
var bColor=bColorLog.open('w');
bColorLog.write(bArray);
}
//434445
if (bArray[0]==15){
var bArray=[15,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],fColor.rgb.red,fColor.rgb.green,fColor.rgb.blue];
var bColor=bColorLog.open('w');
bColorLog.write(bArray);
}
var dialog = new Window("dialog");
dialog.text = "Slot ["+bArray[0]+"]";
dialog.alignChildren = ["center","top"];
dialog.spacing = 10;
dialog.margins = 16;
var group1 = dialog.add("group", undefined, {name: "group1"});
group1.orientation = "row";
group1.alignChildren = ["left","center"];
group1.spacing = 10;
group1.margins = 0;
var group2 = dialog.add("group", undefined, {name: "group2"});
group1.orientation = "row";
group1.alignChildren = ["left","center"];
group1.spacing = 10;
group1.margins = 0;
var group3 = dialog.add("group", undefined, {name: "group3"});
group1.orientation = "row";
group1.alignChildren = ["left","center"];
group1.spacing = 10;
group1.margins = 0;
//123
if (bArray[0]==1){
var panel1 = group1.add("panel", undefined, undefined, {name: "panel1"});
panel1.orientation = "column";
panel1.alignChildren = ["left","top"];
panel1.spacing = 5;
panel1.margins = 5;
var button1 = panel1.add("button", undefined, undefined, {name: "button1"});
}
else{
var button1 = group1.add("button", undefined, undefined, {name: "button1"});
};
button1.fillBrush = button1.graphics.newBrush( button1.graphics.BrushType.SOLID_COLOR, [bArray[1]/255,bArray[2]/255,bArray[3]/255,1] );
button1.onDraw = function(){
with( this ) {
graphics.drawOSControl();
graphics.rectPath(0,0,size[0],size[1]);
graphics.fillPath(fillBrush);
}
};
button1.onClick = function() {
var cObj= new SolidColor();
cObj.rgb.red= bArray[1];
cObj.rgb.green= bArray[2];
cObj.rgb.blue= bArray[3];
app.foregroundColor= cObj;
var newArray=[1,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
bColorLog.open('w');
bColorLog.write(newArray);
bColorLog.close();
dialog.close();
}
//456
if (bArray[0]==2){
var panel1 = group1.add("panel", undefined, undefined, {name: "panel1"});
panel1.orientation = "column";
panel1.alignChildren = ["left","top"];
panel1.spacing = 5;
panel1.margins = 5;
var button2 = panel1.add("button", undefined, undefined, {name: "button1"});
}
else{
var button2 = group1.add("button", undefined, undefined, {name: "button1"});
};
button2.fillBrush = button2.graphics.newBrush( button2.graphics.BrushType.SOLID_COLOR, [bArray[4]/255,bArray[5]/255,bArray[6]/255,1] );
button2.onDraw = function(){
with( this ) {
graphics.drawOSControl();
graphics.rectPath(0,0,size[0],size[1]);
graphics.fillPath(fillBrush);
}
};
button2.onClick = function() {
var cObj= new SolidColor();
cObj.rgb.red= bArray[4];
cObj.rgb.green= bArray[5];
cObj.rgb.blue= bArray[6];
app.foregroundColor= cObj;
var newArray=[2,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
bColorLog.open('w');
bColorLog.write(newArray);
bColorLog.close();
dialog.close();
}
//789
if (bArray[0]==3){
var panel1 = group1.add("panel", undefined, undefined, {name: "panel1"});
panel1.orientation = "column";
panel1.alignChildren = ["left","top"];
panel1.spacing = 5;
panel1.margins = 5;
var button3 = panel1.add("button", undefined, undefined, {name: "button1"});
}
else{
var button3 = group1.add("button", undefined, undefined, {name: "button1"});
};
button3.fillBrush = button3.graphics.newBrush( button3.graphics.BrushType.SOLID_COLOR, [bArray[7]/255,bArray[8]/255,bArray[9]/255,1] );
button3.onDraw = function(){
with( this ) {
graphics.drawOSControl();
graphics.rectPath(0,0,size[0],size[1]);
graphics.fillPath(fillBrush);
}
};
button3.onClick = function() {
var cObj= new SolidColor();
cObj.rgb.red= bArray[7];
cObj.rgb.green= bArray[8];
cObj.rgb.blue= bArray[9];
app.foregroundColor= cObj;
var newArray=[3,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
bColorLog.open('w');
bColorLog.write(newArray);
bColorLog.close();
dialog.close();
}
//101112
if (bArray[0]==4){
var panel1 = group1.add("panel", undefined, undefined, {name: "panel1"});
panel1.orientation = "column";
panel1.alignChildren = ["left","top"];
panel1.spacing = 5;
panel1.margins = 5;
var button4 = panel1.add("button", undefined, undefined, {name: "button1"});
}
else{
var button4 = group1.add("button", undefined, undefined, {name: "button1"});
};
button4.fillBrush = button4.graphics.newBrush( button4.graphics.BrushType.SOLID_COLOR, [bArray[10]/255,bArray[11]/255,bArray[12]/255,1] );
button4.onDraw = function(){
with( this ) {
graphics.drawOSControl();
graphics.rectPath(0,0,size[0],size[1]);
graphics.fillPath(fillBrush);
}
};
button4.onClick = function() {
var cObj= new SolidColor();
cObj.rgb.red= bArray[10];
cObj.rgb.green= bArray[11];
cObj.rgb.blue= bArray[12];
app.foregroundColor= cObj;
var newArray=[4,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
bColorLog.open('w');
bColorLog.write(newArray);
bColorLog.close();
dialog.close();
}
//131415
if (bArray[0]==5){
var panel1 = group1.add("panel", undefined, undefined, {name: "panel1"});
panel1.orientation = "column";
panel1.alignChildren = ["left","top"];
panel1.spacing = 5;
panel1.margins = 5;
var button5 = panel1.add("button", undefined, undefined, {name: "button1"});
}
else{
var button5 = group1.add("button", undefined, undefined, {name: "button1"});
};
button5.fillBrush = button5.graphics.newBrush( button5.graphics.BrushType.SOLID_COLOR, [bArray[13]/255,bArray[14]/255,bArray[15]/255,1] );
button5.onDraw = function(){
with( this ) {
graphics.drawOSControl();
graphics.rectPath(0,0,size[0],size[1]);
graphics.fillPath(fillBrush);
}
};
button5.onClick = function() {
var cObj= new SolidColor();
cObj.rgb.red= bArray[13];
cObj.rgb.green= bArray[14];
cObj.rgb.blue= bArray[15];
app.foregroundColor= cObj;
var newArray=[5,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
bColorLog.open('w');
bColorLog.write(newArray);
bColorLog.close();
dialog.close();
}
//ここまでが上段
//161718
if (bArray[0]==6){
var panel1 = group2.add("panel", undefined, undefined, {name: "panel1"});
panel1.orientation = "column";
panel1.alignChildren = ["left","top"];
panel1.spacing = 5;
panel1.margins = 5;
var button6 = panel1.add("button", undefined, undefined, {name: "button1"});
}
else{
var button6 = group2.add("button", undefined, undefined, {name: "button1"});
};
button6.fillBrush = button6.graphics.newBrush( button6.graphics.BrushType.SOLID_COLOR, [bArray[16]/255,bArray[17]/255,bArray[18]/255,1] );
button6.onDraw = function(){
with( this ) {
graphics.drawOSControl();
graphics.rectPath(0,0,size[0],size[1]);
graphics.fillPath(fillBrush);
}
};
button6.onClick = function() {
var cObj= new SolidColor();
cObj.rgb.red= bArray[16];
cObj.rgb.green= bArray[17];
cObj.rgb.blue= bArray[18];
app.foregroundColor= cObj;
var newArray=[6,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
bColorLog.open('w');
bColorLog.write(newArray);
bColorLog.close();
dialog.close();
}
//192021
if (bArray[0]==7){
var panel1 = group2.add("panel", undefined, undefined, {name: "panel1"});
panel1.orientation = "column";
panel1.alignChildren = ["left","top"];
panel1.spacing = 5;
panel1.margins = 5;
var button7 = panel1.add("button", undefined, undefined, {name: "button1"});
}
else{
var button7 = group2.add("button", undefined, undefined, {name: "button1"});
};
button7.fillBrush = button7.graphics.newBrush( button7.graphics.BrushType.SOLID_COLOR, [bArray[19]/255,bArray[20]/255,bArray[21]/255,1] );
button7.onDraw = function(){
with( this ) {
graphics.drawOSControl();
graphics.rectPath(0,0,size[0],size[1]);
graphics.fillPath(fillBrush);
}
};
button7.onClick = function() {
var cObj= new SolidColor();
cObj.rgb.red= bArray[19];
cObj.rgb.green= bArray[20];
cObj.rgb.blue= bArray[21];
app.foregroundColor= cObj;
var newArray=[7,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
bColorLog.open('w');
bColorLog.write(newArray);
bColorLog.close();
dialog.close();
}
//2222324
if (bArray[0]==8){
var panel1 = group2.add("panel", undefined, undefined, {name: "panel1"});
panel1.orientation = "column";
panel1.alignChildren = ["left","top"];
panel1.spacing = 5;
panel1.margins = 5;
var button8 = panel1.add("button", undefined, undefined, {name: "button1"});
}
else{
var button8 = group2.add("button", undefined, undefined, {name: "button1"});
};
button8.fillBrush = button8.graphics.newBrush( button8.graphics.BrushType.SOLID_COLOR, [bArray[22]/255,bArray[23]/255,bArray[24]/255,1] );
button8.onDraw = function(){
with( this ) {
graphics.drawOSControl();
graphics.rectPath(0,0,size[0],size[1]);
graphics.fillPath(fillBrush);
}
};
button8.onClick = function() {
var cObj= new SolidColor();
cObj.rgb.red= bArray[22];
cObj.rgb.green= bArray[23];
cObj.rgb.blue= bArray[24];
app.foregroundColor= cObj;
var newArray=[8,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
bColorLog.open('w');
bColorLog.write(newArray);
bColorLog.close();
dialog.close();
}
//252627
if (bArray[0]==9){
var panel1 = group2.add("panel", undefined, undefined, {name: "panel1"});
panel1.orientation = "column";
panel1.alignChildren = ["left","top"];
panel1.spacing = 5;
panel1.margins = 5;
var button9 = panel1.add("button", undefined, undefined, {name: "button1"});
}
else{
var button9 = group2.add("button", undefined, undefined, {name: "button1"});
};
button9.fillBrush = button9.graphics.newBrush( button9.graphics.BrushType.SOLID_COLOR, [bArray[25]/255,bArray[26]/255,bArray[27]/255,1] );
button9.onDraw = function(){
with( this ) {
graphics.drawOSControl();
graphics.rectPath(0,0,size[0],size[1]);
graphics.fillPath(fillBrush);
}
};
button9.onClick = function() {
var cObj= new SolidColor();
cObj.rgb.red= bArray[25];
cObj.rgb.green= bArray[26];
cObj.rgb.blue= bArray[27];
app.foregroundColor= cObj;
var newArray=[9,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
bColorLog.open('w');
bColorLog.write(newArray);
bColorLog.close();
dialog.close();
}
//282930
if (bArray[0]==10){
var panel1 = group2.add("panel", undefined, undefined, {name: "panel1"});
panel1.orientation = "column";
panel1.alignChildren = ["left","top"];
panel1.spacing = 5;
panel1.margins = 5;
var button10 = panel1.add("button", undefined, undefined, {name: "button1"});
}
else{
var button10 = group2.add("button", undefined, undefined, {name: "button1"});
};
button10.fillBrush = button10.graphics.newBrush( button10.graphics.BrushType.SOLID_COLOR, [bArray[28]/255,bArray[29]/255,bArray[30]/255,1] );
button10.onDraw = function(){
with( this ) {
graphics.drawOSControl();
graphics.rectPath(0,0,size[0],size[1]);
graphics.fillPath(fillBrush);
}
};
button10.onClick = function() {
var cObj= new SolidColor();
cObj.rgb.red= bArray[28];
cObj.rgb.green= bArray[29];
cObj.rgb.blue= bArray[30];
app.foregroundColor= cObj;
var newArray=[10,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
bColorLog.open('w');
bColorLog.write(newArray);
bColorLog.close();
dialog.close();
}
//ここまでが上段
//313233
if (bArray[0]==11){
var panel1 = group3.add("panel", undefined, undefined, {name: "panel1"});
panel1.orientation = "column";
panel1.alignChildren = ["left","top"];
panel1.spacing = 5;
panel1.margins = 5;
var button11 = panel1.add("button", undefined, undefined, {name: "button1"});
}
else{
var button11 = group3.add("button", undefined, undefined, {name: "button1"});
};
button11.fillBrush = button11.graphics.newBrush( button11.graphics.BrushType.SOLID_COLOR, [bArray[31]/255,bArray[32]/255,bArray[33]/255,1] );
button11.onDraw = function(){
with( this ) {
graphics.drawOSControl();
graphics.rectPath(0,0,size[0],size[1]);
graphics.fillPath(fillBrush);
}
};
button11.onClick = function() {
var cObj= new SolidColor();
cObj.rgb.red= bArray[31];
cObj.rgb.green= bArray[32];
cObj.rgb.blue= bArray[33];
app.foregroundColor= cObj;
var newArray=[11,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
bColorLog.open('w');
bColorLog.write(newArray);
bColorLog.close();
dialog.close();
}
//343536
if (bArray[0]==12){
var panel1 = group3.add("panel", undefined, undefined, {name: "panel1"});
panel1.orientation = "column";
panel1.alignChildren = ["left","top"];
panel1.spacing = 5;
panel1.margins = 5;
var button12 = panel1.add("button", undefined, undefined, {name: "button1"});
}
else{
var button12 = group3.add("button", undefined, undefined, {name: "button1"});
};
button12.fillBrush = button12.graphics.newBrush( button12.graphics.BrushType.SOLID_COLOR, [bArray[34]/255,bArray[35]/255,bArray[36]/255,1] );
button12.onDraw = function(){
with( this ) {
graphics.drawOSControl();
graphics.rectPath(0,0,size[0],size[1]);
graphics.fillPath(fillBrush);
}
};
button12.onClick = function() {
var cObj= new SolidColor();
cObj.rgb.red= bArray[34];
cObj.rgb.green= bArray[35];
cObj.rgb.blue= bArray[36];
app.foregroundColor= cObj;
var newArray=[12,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
bColorLog.open('w');
bColorLog.write(newArray);
bColorLog.close();
dialog.close();
}
//373839
if (bArray[0]==13){
var panel1 = group3.add("panel", undefined, undefined, {name: "panel1"});
panel1.orientation = "column";
panel1.alignChildren = ["left","top"];
panel1.spacing = 5;
panel1.margins = 5;
var button13 = panel1.add("button", undefined, undefined, {name: "button1"});
}
else{
var button13 = group3.add("button", undefined, undefined, {name: "button1"});
};
button13.fillBrush = button13.graphics.newBrush( button13.graphics.BrushType.SOLID_COLOR, [bArray[37]/255,bArray[38]/255,bArray[39]/255,1] );
button13.onDraw = function(){
with( this ) {
graphics.drawOSControl();
graphics.rectPath(0,0,size[0],size[1]);
graphics.fillPath(fillBrush);
}
};
button13.onClick = function() {
var cObj= new SolidColor();
cObj.rgb.red= bArray[37];
cObj.rgb.green= bArray[38];
cObj.rgb.blue= bArray[39];
app.foregroundColor= cObj;
var newArray=[13,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
bColorLog.open('w');
bColorLog.write(newArray);
bColorLog.close();
dialog.close();
}
//404142
if (bArray[0]==14){
var panel1 = group3.add("panel", undefined, undefined, {name: "panel1"});
panel1.orientation = "column";
panel1.alignChildren = ["left","top"];
panel1.spacing = 5;
panel1.margins = 5;
var button14 = panel1.add("button", undefined, undefined, {name: "button1"});
}
else{
var button14 = group3.add("button", undefined, undefined, {name: "button1"});
};
button14.fillBrush = button14.graphics.newBrush( button14.graphics.BrushType.SOLID_COLOR, [bArray[40]/255,bArray[41]/255,bArray[42]/255,1] );
button14.onDraw = function(){
with( this ) {
graphics.drawOSControl();
graphics.rectPath(0,0,size[0],size[1]);
graphics.fillPath(fillBrush);
}
};
button14.onClick = function() {
var cObj= new SolidColor();
cObj.rgb.red= bArray[40];
cObj.rgb.green= bArray[41];
cObj.rgb.blue= bArray[42];
app.foregroundColor= cObj;
var newArray=[14,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
bColorLog.open('w');
bColorLog.write(newArray);
bColorLog.close();
dialog.close();
}
//434445
if (bArray[0]==15){
var panel1 = group3.add("panel", undefined, undefined, {name: "panel1"});
panel1.orientation = "column";
panel1.alignChildren = ["left","top"];
panel1.spacing = 5;
panel1.margins = 5;
var button15 = panel1.add("button", undefined, undefined, {name: "button1"});
}
else{
var button15 = group3.add("button", undefined, undefined, {name: "button1"});
};
button15.fillBrush = button15.graphics.newBrush( button15.graphics.BrushType.SOLID_COLOR, [bArray[43]/255,bArray[44]/255,bArray[45]/255,1] );
button15.onDraw = function(){
with( this ) {
graphics.drawOSControl();
graphics.rectPath(0,0,size[0],size[1]);
graphics.fillPath(fillBrush);
}
};
button15.onClick = function() {
var cObj= new SolidColor();
cObj.rgb.red= bArray[43];
cObj.rgb.green= bArray[44];
cObj.rgb.blue= bArray[45];
app.foregroundColor= cObj;
var newArray=[15,bArray[1],bArray[2],bArray[3],bArray[4],bArray[5],bArray[6],bArray[7],
bArray[8],bArray[9],bArray[10],bArray[11],bArray[12],bArray[13],bArray[14],bArray[15],bArray[16],bArray[17],
bArray[18],bArray[19],bArray[20],bArray[21],bArray[22],bArray[23],bArray[24],bArray[25],bArray[26],bArray[27],
bArray[28],bArray[29],bArray[30],bArray[31],bArray[32],bArray[33],bArray[34],bArray[35],bArray[36],bArray[37],
bArray[38],bArray[39],bArray[40],bArray[41],bArray[42],bArray[43],bArray[44],bArray[45]];
bColorLog.open('w');
bColorLog.write(newArray);
bColorLog.close();
dialog.close();
}
dialog.show();
自分で試したこと
catch eを試しましたが、プログラムが停止してしまいます。
Adobe Photoshop 2020だと正常にプログラムが実行されます