Copy link to clipboard
Copied
I added a palette to a script to perform a task that took too long, but the palette display behaves strangely, displays a white background and does not display the elements of the palette. Has anyone had this same problem?
Follow the image.
p.show(); p.active = true; refresh(); $.sleep(5000);
Copy link to clipboard
Copied
Windows 10.
Photoshop CC21.0
Original script for testing! All help is valid, thanks.
#target photoshop
dlg = new Window("dialog"); dlg.text = "Ps-fxRios - Acabamento para Foto Album";
dlg.preferredSize.width = 200; dlg.preferredSize.height = 50;
dlg.orientation = "column"; dlg.alignChildren = ["center","top"];
dlg.spacing = 10; dlg.margins = 11;
gpD = dlg.add("group", undefined, {name: "gpD"});
gpD.orientation = "row"; gpD.alignChildren = ["left","top"];
gpD.spacing = 10; gpD.margins = 0;
g1 = gpD.add("group", undefined, {name: "g1"});
g1.orientation = "column"; g1.alignChildren = ["left","center"];
g1.spacing = 10; g1.margins = 0;
p1 = g1.add("panel", undefined, undefined, {name: "p1"}); p1.text = "Preferêcias";
p1.preferredSize.width = 167; p1.orientation = "column";
p1.alignChildren = ["center","top"]; p1.spacing = 3; p1.margins = 10;
p0 = p1.add("panel", undefined, undefined, {name: "p0"});
p0.preferredSize.width = 164; p0.orientation = "column";
p0.alignChildren = ["center","top"]; p0.spacing = 0; p0.margins = 2;
g2 = p0.add("group", undefined, {name: "g2"});
g2.orientation = "row"; g2.alignChildren = ["left","center"];
g2.spacing = 1; g2.margins = [0,0,0,3];
r1 = g2.add("radiobutton", undefined, undefined, {name: "r1"}); r1.text = "Album"; r1.value = true;
r2 = g2.add("radiobutton", undefined, undefined, {name: "r2"}); r2.text = "Fotobook";
r1.onClick = function(){
et1.text = "50"; et2.text = "25"; p2c.enabled=true; list1.selection = 0;
p2b.enabled=true;
}
r2.onClick = function(){
et1.text = "30.4"; et2.text = "21.1"; p2c.enabled=false; list1.selection = 1;
p2b.enabled=false;
}
p2 = p1.add("panel", undefined, undefined, {name: "p2"}); p2.preferredSize.width = 164;
p2.orientation = "row"; p2.alignChildren = ["left","top"]; p2.spacing = 2; p2.margins = 5;
st1 = p2.add("statictext", undefined, undefined, {name: "st1"}); st1.text = "Serviço";
st1.preferredSize.width = 48; st1.justify = "right"; st1.alignment = ["left","center"];
list1_array = ["Capa","Luva","Maleta"];
list1 = p2.add("dropdownlist", undefined, undefined, {name: "list1", items: list1_array});
list1.selection = 0; list1.preferredSize.width = 89;
list1.onChange = function(){
if(r1.value){
switch(parseInt(list1.selection)){ case 0: p2b.enabled= true; break;
case 1: p2b.enabled=false; break; case 2: p2b.enabled=false; break;
}};
else if(r2.value){
switch(parseInt(list1.selection)){ case 0: list1.selection = 1; break;
case 1: list1.selection = 1; break; case 2: list1.selection = 2; p2b.enabled=false; break;
}};
}
p2a = p1.add("panel", undefined, undefined, {name: "p2a"});
p2a.preferredSize.width = 164; p2a.orientation = "column";
p2a.alignChildren = ["center","top"]; p2a.spacing = 10; p2a.margins = 10;
p2b = p1.add("panel", undefined, undefined, {name: "p2b"});
p2b.preferredSize.width = 164; p2b.orientation = "row";
p2b.alignChildren = ["left","top"]; p2b.spacing = 2; p2b.margins = 5;
st2 = p2b.add("statictext", undefined, undefined, {name: "st2"}); st2.text = "Modelo";
st2.preferredSize.width = 48; st2.justify = "right"; st2.alignment = ["left","center"];
list2_array = ["Padrão","Magnética"];
list2 = p2b.add("dropdownlist", undefined, undefined, {name: "list2", items: list2_array});
list2.selection = 0; list2.preferredSize.width = 89;
p2c = p1.add("panel", undefined, undefined, {name: "p2c"});
p2c.preferredSize.width = 164; p2c.orientation = "row"; p2c.alignChildren = ["center","top"];
p2c.spacing = 0; p2c.margins = 5;
g3 = p2c.add("group", undefined, {name: "g3"}); g3.orientation = "column";
g3.alignChildren = ["right","center"]; g3.spacing = 0; g3.margins = 0;
g4 = g3.add("group", undefined, {name: "g4"});
g4.orientation = "row"; g4.alignChildren = ["left","center"]; g4.spacing = 0; g4.margins = 0;
st3 = g4.add("statictext", undefined, undefined, {name: "st3"}); st3.text = "Largura ";
st3.preferredSize.width = 49; st3.justify = "right"; st3.alignment = ["left","center"];
et1 = g4.add('edittext {justify: "center", properties: {name: "et1"}}'); et1.text = "50";
et1.alignment = ["left","center"];
g5 = g4.add("group", undefined, {name: "g5"}); g5.orientation = "column";
g5.alignChildren = ["left","center"]; g5.spacing = 0; g5.margins = 0;
i1_imgString = "%C2%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%0F%00%00%00%0A%08%02%00%00%00%C3%A4y%C2%93%C2%AE%00%00%00%09pHYs%00%00%0E%C3%84%00%00%0E%C3%84%01%C2%95%2B%0E%1B%00%00%05%C3%B1iTXtXML%3Acom.adobe.xmp%00%00%00%00%00%3C%3Fxpacket%20begin%3D%22%C3%AF%C2%BB%C2%BF%22%20id%3D%22W5M0MpCehiHzreSzNTczkc9d%22%3F%3E%20%3Cx%3Axmpmeta%20xmlns%3Ax%3D%22adobe%3Ans%3Ameta%2F%22%20x%3Axmptk%3D%22Adobe%20XMP%20Core%205.6-c148%2079.164036%2C%202019%2F08%2F13-01%3A06%3A57%20%20%20%20%20%20%20%20%22%3E%20%3Crdf%3ARDF%20xmlns%3Ardf%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%22%3E%20%3Crdf%3ADescription%20rdf%3Aabout%3D%22%22%20xmlns%3Axmp%3D%22http%3A%2F%2Fns.adobe.com%2Fxap%2F1.0%2F%22%20xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%20xmlns%3Aphotoshop%3D%22http%3A%2F%2Fns.adobe.com%2Fphotoshop%2F1.0%2F%22%20xmlns%3AxmpMM%3D%22http%3A%2F%2Fns.adobe.com%2Fxap%2F1.0%2Fmm%2F%22%20xmlns%3AstEvt%3D%22http%3A%2F%2Fns.adobe.com%2Fxap%2F1.0%2FsType%2FResourceEvent%23%22%20xmp%3ACreatorTool%3D%22Adobe%20Photoshop%2021.0%20(Windows)%22%20xmp%3ACreateDate%3D%222020-08-23T20%3A32%3A46-03%3A00%22%20xmp%3AModifyDate%3D%222020-08-23T20%3A33%3A43-03%3A00%22%20xmp%3AMetadataDate%3D%222020-08-23T20%3A33%3A43-03%3A00%22%20dc%3Aformat%3D%22image%2Fpng%22%20photoshop%3AColorMode%3D%223%22%20photoshop%3AICCProfile%3D%22sRGB%20IEC61966-2.1%22%20xmpMM%3AInstanceID%3D%22xmp.iid%3Ab0d02dc4-56ca-a146-97f0-9b2bee10c2fa%22%20xmpMM%3ADocumentID%3D%22adobe%3Adocid%3Aphotoshop%3A51f15afc-ac4a-d046-bb4a-399775cd85b8%22%20xmpMM%3AOriginalDocumentID%3D%22xmp.did%3Aceb5af5b-b639-564f-bc07-e959f2fe79f8%22%3E%20%3CxmpMM%3AHistory%3E%20%3Crdf%3ASeq%3E%20%3Crdf%3Ali%20stEvt%3Aaction%3D%22created%22%20stEvt%3AinstanceID%3D%22xmp.iid%3Aceb5af5b-b639-564f-bc07-e959f2fe79f8%22%20stEvt%3Awhen%3D%222020-08-23T20%3A32%3A46-03%3A00%22%20stEvt%3AsoftwareAgent%3D%22Adobe%20Photoshop%2021.0%20(Windows)%22%2F%3E%20%3Crdf%3Ali%20stEvt%3Aaction%3D%22saved%22%20stEvt%3AinstanceID%3D%22xmp.iid%3Ab0d02dc4-56ca-a146-97f0-9b2bee10c2fa%22%20stEvt%3Awhen%3D%222020-08-23T20%3A33%3A43-03%3A00%22%20stEvt%3AsoftwareAgent%3D%22Adobe%20Photoshop%2021.0%20(Windows)%22%20stEvt%3Achanged%3D%22%2F%22%2F%3E%20%3C%2Frdf%3ASeq%3E%20%3C%2FxmpMM%3AHistory%3E%20%3C%2Frdf%3ADescription%3E%20%3C%2Frdf%3ARDF%3E%20%3C%2Fx%3Axmpmeta%3E%20%3C%3Fxpacket%20end%3D%22r%22%3F%3E%3Fq%C2%B8%C3%AD%00%00%00%7DIDAT%18%C2%95%C2%95%C2%8F%C2%B1%0DC!%0CD%C3%8F%1F%24j%16%60%0B%1A%C2%86q%C3%A9%7D%C3%BE0%C2%9E%07%C2%89%C3%9E%15-%C2%88%C2%B4Q%20%C3%B9%C3%8Ak%C3%AF%C2%9Du%26%11%C3%81%13k%C2%AD1F%C3%AF%C3%9D%03h%C2%AD%C3%BD%C2%B6%C2%89(%C2%84%10c%C3%B4%00%C3%A6%C2%9C%C2%8F%C3%A7%01x%C3%AF%C2%AFcPJ%C3%99%C3%87%10%C3%91%C3%81f%C3%A6%C2%9C33%C3%AF%C3%91%C2%A7%C3%8D%C3%8Cfv%C3%9F%C2%B7%C2%99%C3%AD%C2%85kWU%15%C2%80%C2%AA%C3%AE%05%12%C2%91Z%C3%ABq%C3%BD%3B%C3%8E%C2%B9%C2%94%C3%92%C3%B9%C3%8Bo%C3%BCg%C2%BF%00%C3%82%C3%B60%2F%C2%8F%C2%A3%1A%C3%9D%00%00%00%00IEND%C2%AEB%60%C2%82";
i1 = g5.add("image", undefined, File.decode(i1_imgString), {name: "i1"}); i1.size = [15, 10];
i2_imgString = "%C2%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%0F%00%00%00%0A%08%02%00%00%00%C3%A4y%C2%93%C2%AE%00%00%00%09pHYs%00%00%0E%C3%84%00%00%0E%C3%84%01%C2%95%2B%0E%1B%00%00%05%C3%B1iTXtXML%3Acom.adobe.xmp%00%00%00%00%00%3C%3Fxpacket%20begin%3D%22%C3%AF%C2%BB%C2%BF%22%20id%3D%22W5M0MpCehiHzreSzNTczkc9d%22%3F%3E%20%3Cx%3Axmpmeta%20xmlns%3Ax%3D%22adobe%3Ans%3Ameta%2F%22%20x%3Axmptk%3D%22Adobe%20XMP%20Core%205.6-c148%2079.164036%2C%202019%2F08%2F13-01%3A06%3A57%20%20%20%20%20%20%20%20%22%3E%20%3Crdf%3ARDF%20xmlns%3Ardf%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%22%3E%20%3Crdf%3ADescription%20rdf%3Aabout%3D%22%22%20xmlns%3Axmp%3D%22http%3A%2F%2Fns.adobe.com%2Fxap%2F1.0%2F%22%20xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%20xmlns%3Aphotoshop%3D%22http%3A%2F%2Fns.adobe.com%2Fphotoshop%2F1.0%2F%22%20xmlns%3AxmpMM%3D%22http%3A%2F%2Fns.adobe.com%2Fxap%2F1.0%2Fmm%2F%22%20xmlns%3AstEvt%3D%22http%3A%2F%2Fns.adobe.com%2Fxap%2F1.0%2FsType%2FResourceEvent%23%22%20xmp%3ACreatorTool%3D%22Adobe%20Photoshop%2021.0%20(Windows)%22%20xmp%3ACreateDate%3D%222020-08-23T20%3A32%3A46-03%3A00%22%20xmp%3AModifyDate%3D%222020-08-23T20%3A33%3A28-03%3A00%22%20xmp%3AMetadataDate%3D%222020-08-23T20%3A33%3A28-03%3A00%22%20dc%3Aformat%3D%22image%2Fpng%22%20photoshop%3AColorMode%3D%223%22%20photoshop%3AICCProfile%3D%22sRGB%20IEC61966-2.1%22%20xmpMM%3AInstanceID%3D%22xmp.iid%3A80b65c73-745e-1949-aa91-c642567d5c8b%22%20xmpMM%3ADocumentID%3D%22adobe%3Adocid%3Aphotoshop%3A8e014599-520f-5049-9d05-fe980e454ed5%22%20xmpMM%3AOriginalDocumentID%3D%22xmp.did%3A3bcd5cc6-5b38-ab46-973e-3d9f45a1b5ce%22%3E%20%3CxmpMM%3AHistory%3E%20%3Crdf%3ASeq%3E%20%3Crdf%3Ali%20stEvt%3Aaction%3D%22created%22%20stEvt%3AinstanceID%3D%22xmp.iid%3A3bcd5cc6-5b38-ab46-973e-3d9f45a1b5ce%22%20stEvt%3Awhen%3D%222020-08-23T20%3A32%3A46-03%3A00%22%20stEvt%3AsoftwareAgent%3D%22Adobe%20Photoshop%2021.0%20(Windows)%22%2F%3E%20%3Crdf%3Ali%20stEvt%3Aaction%3D%22saved%22%20stEvt%3AinstanceID%3D%22xmp.iid%3A80b65c73-745e-1949-aa91-c642567d5c8b%22%20stEvt%3Awhen%3D%222020-08-23T20%3A33%3A28-03%3A00%22%20stEvt%3AsoftwareAgent%3D%22Adobe%20Photoshop%2021.0%20(Windows)%22%20stEvt%3Achanged%3D%22%2F%22%2F%3E%20%3C%2Frdf%3ASeq%3E%20%3C%2FxmpMM%3AHistory%3E%20%3C%2Frdf%3ADescription%3E%20%3C%2Frdf%3ARDF%3E%20%3C%2Fx%3Axmpmeta%3E%20%3C%3Fxpacket%20end%3D%22r%22%3F%3Ew%01%C3%A7)%00%00%00%C2%90IDAT%18%C2%95%C2%A5%C2%8F%C2%BD%0D%03!%0CF%0D%3E%C2%89%C3%B2%0Az%C2%96%60%0C%C3%AF%40I%C3%8BN%C2%9E%C2%81%19%C3%A8%C2%99%C2%80%15%C2%90h%C2%91%C2%9C%C3%A2%C2%A4%C2%88%24%C3%B7S%C3%A4%C3%AB%C3%BC%C3%A9%3D%C3%8BV1%C3%86%C3%96%1A%3C%05%11%C2%9Ds%C3%BA%C2%91%5B%C3%B3%07%1DB%20%C2%A2%C3%B7HD!%C2%84K%C2%9A%C2%99%C2%AD%C2%B5%C2%87%40D%C3%96Zf%C2%BE%C2%BB%C3%A4%10RJ%C2%BF(%00%C2%A0%C3%B7%C2%BE%C3%B7%C2%BEV%C2%B5VD%C3%8C9%7Fl%C3%95z%C3%9F%C3%B7%C3%B3%2FK)_%C2%8DRJD6%00%40%C3%84SgE%C2%8D1s%C3%8E%0D%00%C2%9Cs%C3%B7%C2%B4%C2%88%C3%8C9%C3%87%18%2F%C3%A4%C2%93-%C2%8BX%C3%B3F%3A%00%00%00%00IEND%C2%AEB%60%C2%82";
i2 = g5.add("image", undefined, File.decode(i2_imgString), {name: "i2"}); i2.size = [15, 10];
i1.onClick = function() {
if(r1.value){et1.text = Number(et1.text)+1;};
};
i2.onClick = function() {
if(r1.value){et1.text = Number(et1.text) -1;};
};
st5 = g4.add("statictext", undefined, undefined, {name: "st5"}); st5.text = "cm......"; st5.justify = "center";
g1c = g3.add("group", undefined, {name: "g1c"}); g1c.orientation = "row";
g1c.alignChildren = ["left","center"]; g1c.spacing = 0; g1c.margins = 0; g1c.alignment = ["center","center"];
st4 = g1c.add("statictext", undefined, undefined, {name: "st4"}); st4.text = "Altura ";
st4.preferredSize.width = 50; st4.justify = "right"; st4.alignment = ["left","center"];
et2 = g1c.add('edittext {justify: "center", properties: {name: "et2"}}'); et2.text = "25";
et2.alignment = ["left","center"];
g6 = g1c.add("group", undefined, {name: "g6"}); g6.orientation = "column";
g6.alignChildren = ["left","center"]; g6.spacing = 0; g6.margins = 0;
i3 = g6.add("image", undefined, File.decode(i1_imgString), {name: "i3"}); i3.size = [15, 10];
i4 = g6.add("image", undefined, File.decode(i2_imgString), {name: "i4"}); i4.size = [15, 10];
i3.onClick = function() {
if(r1.value){et2.text = Number(et2.text)+1; }
};
i4.onClick = function() {
if(r1.value){et2.text = Number(et2.text) -1; }
};
st6 = g1c.add("statictext", undefined, undefined, {name: "st6"}); st6.text = "cm......"; st6.justify = "center";
p2d = p1.add("panel", undefined, undefined, {name: "p2d"}); p2d.preferredSize.width = 164;
p2d.orientation = "column"; p2d.alignChildren = ["left","top"]; p2d.spacing = 10; p2d.margins = 10;
p2e = p1.add("panel", undefined, undefined, {name: "p2e"}); p2e.preferredSize.width = 164;
p2e.orientation = "row"; p2e.alignChildren = ["left","top"]; p2e.spacing = 2; p2e.margins = 8;
g7 = p2e.add("group", undefined, {name: "g7"}); g7.orientation = "row";
g7.alignChildren = ["center","center"]; g7.spacing = 0; g7.margins = 0; g7.alignment = ["left","center"];
st7 = g7.add("statictext", undefined, undefined, {name: "st7"}); st7.text = "Total de";
st7.justify = "right"; st7.alignment = ["center","center"];
gpd2 = p2e.add("group", undefined, {name: "gpd2"}); gpd2.orientation = "row";
gpd2.alignChildren = ["left","center"]; gpd2.spacing = 0; gpd2.margins = 0;
et3 = gpd2.add('edittext {justify: "center", properties: {name: "et3"}}'); et3.text = "20";
et3.alignment = ["left","center"];
g8 = gpd2.add("group", undefined, {name: "g8"}); g8.orientation = "column";
g8.alignChildren = ["left","center"]; g8.spacing = 0; g8.margins = 0;
i5 = g8.add("image", undefined, File.decode(i1_imgString), {name: "i5"}); i5.size = [15, 10];
i6 = g8.add("image", undefined, File.decode(i2_imgString), {name: "i6"}); i6.size = [15, 10];
i5.onClick = function() {
if(et3.text > 29){ }else{et3.text = Number(et3.text)+1;}
};
i6.onClick = function() {
if(et3.text < 11){ }else{et3.text = Number(et3.text) -1;}
};
st8 = gpd2.add("statictext", undefined, undefined, {name: "st8"}); st8.text = "Lâminas"; st8.justify = "center";
g9 = gpD.add("group", undefined, {name: "g9"});
g9.orientation = "column"; g9.alignChildren = ["center","center"];
g9.spacing = 1; g9.margins = 0;
b1 = g9.add("button", undefined, undefined, {name: "ok"}); b1.text = "Process";
b1.preferredSize.width = 90;
b1.onClick = function(){
dlg.close();
p = new Window("palette"); p.text = "Processando!";
p.preferredSize.width = 80; p.preferredSize.height = 100; p.spacing = 0; p.margins = 10;
ic = p.add("statictext", undefined, undefined, {name: "ic"}); ic.text = "icon"; ic.justify = "center";
ic.graphics.font = ScriptUI.newFont("PSfxIcons",60);ic.text = "K"; ic.justify = "center";
t1 = p.add("statictext", undefined, undefined, {name: "t1"});
t1.text = "PROCESSANDO...";
p.show(); $.sleep(5000);
};
b2 = g9.add("button", undefined, undefined, {name: "b2"}); b2.text = "Cancel";
b2.preferredSize.width = 90;
g10 = g9.add("group", undefined, {name: "g10"}); g10.orientation = "column";
g10.alignChildren = ["center","center"]; g10.spacing = 1; g10.margins = [0,7,0,0];
ck1 = g10.add("checkbox", undefined, undefined, {name: "ck1"}); ck1.text = "Add Guias"; ck1.value = true;
ck2 = g10.add("checkbox", undefined, undefined, {name: "ck2"}); ck2.text = "Add Corte";
dlg.show();
Copy link to clipboard
Copied
del
Copy link to clipboard
Copied
change
p.show(); $.sleep(5000);
to
p.show(); refresh(); $.sleep(5000);
Copy link to clipboard
Copied
Hi r-bin thanks for the support.
Unfortunately the opacity of the palette elements is below 70% when executed inside the function b1.onClick = function () {....} in my script:
When the palette is executed outside of any function, the opacity of the palette elements is shown correctly. Man is this a bug?
p = new Window("palette"); p.text = "Processando!";
p.preferredSize.width = 80; p.preferredSize.height = 100; p.spacing = 0; p.margins = 10;
ic = p.add("statictext", undefined, undefined, {name: "ic"}); ic.text = "icon"; ic.justify = "center";
ic.graphics.font = ScriptUI.newFont("arial",60);ic.text = "K"; ic.justify = "center";
t1 = p.add("statictext", undefined, undefined, {name: "t1"});
t1.text = "PROCESSANDO...";
p.show(); refresh(); $.sleep(5000);
Copy link to clipboard
Copied
p.show(); p.active = true; refresh(); $.sleep(5000);
Copy link to clipboard
Copied
Man, you were brilliant, 100% work here. Once again I thank you for the beautiful support. THANK YOU!