Launch a Script with a button

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
rrrrigel
Posts: 1
Joined: May 27th, 2020, 2:28 pm

Hi ! I know there's already an existing script that can launch scripts with a button click.
But I want to do the same thing with my own script for my own workflow.

My question is, How can I inject the code here in my scriptUI?
where I can do the same thing, like launching scripts with a push off a button.

Below is the code of the sample scriptUI I'm building right now,
please note that this is not the final scriptUI its just a sample of what I'm trying to do.
there will be more buttons and functions inside this script to fit my workflow.
thanks for your help, and sorry for my english.

var panelGlobal = this;
var win = (function () {

// WIN
// ===
var win = (panelGlobal instanceof Panel) ? panelGlobal : new Window("palette", undefined, undefined, {maximizeButton: true, minimizeButton: true, resizeable: true});
if ( !(panelGlobal instanceof Panel) ) win.text = "Controls";
win.preferredSize.width = 171;
win.preferredSize.height = 200;
win.orientation = "column";
win.alignChildren = ["center","top"];
win.spacing = 25;
win.margins = 35;

var image1_imgString = "%C2%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00d%00%00%00(%08%06%00%00%00%08x_C%00%00%00%09pHYs%00%00%0A%C3%84%00%00%0A%C3%84%01fm%C2%82%C3%94%00%00%06%C2%8BiTXtXML%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%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%20xmlns%3Aphotoshop%3D%22http%3A%2F%2Fns.adobe.com%2Fphotoshop%2F1.0%2F%22%20xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%20xmp%3ACreatorTool%3D%22Adobe%20Photoshop%2021.0%20(Windows)%22%20xmp%3ACreateDate%3D%222020-05-27T07%3A43%3A35%2B08%3A00%22%20xmp%3AMetadataDate%3D%222020-05-27T07%3A43%3A35%2B08%3A00%22%20xmp%3AModifyDate%3D%222020-05-27T07%3A43%3A35%2B08%3A00%22%20xmpMM%3AInstanceID%3D%22xmp.iid%3A098b2574-63bc-9f48-a014-446860cc5433%22%20xmpMM%3ADocumentID%3D%22adobe%3Adocid%3Aphotoshop%3A05585e6e-eee6-524a-9464-35edd1d4ba7a%22%20xmpMM%3AOriginalDocumentID%3D%22xmp.did%3A3754fa61-abda-3b45-b6bd-8dbe890be0ef%22%20photoshop%3AColorMode%3D%223%22%20photoshop%3AICCProfile%3D%22sRGB%20IEC61966-2.1%22%20dc%3Aformat%3D%22image%2Fpng%22%3E%20%3CxmpMM%3AHistory%3E%20%3Crdf%3ASeq%3E%20%3Crdf%3Ali%20stEvt%3Aaction%3D%22created%22%20stEvt%3AinstanceID%3D%22xmp.iid%3A3754fa61-abda-3b45-b6bd-8dbe890be0ef%22%20stEvt%3Awhen%3D%222020-05-27T07%3A43%3A35%2B08%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%3A098b2574-63bc-9f48-a014-446860cc5433%22%20stEvt%3Awhen%3D%222020-05-27T07%3A43%3A35%2B08%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%3Cphotoshop%3ATextLayers%3E%20%3Crdf%3ABag%3E%20%3Crdf%3Ali%20photoshop%3ALayerName%3D%22L3RD%20REAL%20QUICK%22%20photoshop%3ALayerText%3D%22L3RD%20REAL%20QUICK%22%2F%3E%20%3C%2Frdf%3ABag%3E%20%3C%2Fphotoshop%3ATextLayers%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%C3%981F%C2%99%00%00%03(IDATh%C2%81%C3%AD%C2%9A%C3%91q%C3%9B0%10D%C3%B72i%C2%80)%C2%81)%C2%81)A.%C3%81*A*%C2%81.A.%C3%81*A)%C3%81*%C2%81*%C3%81*A%2Ca%C3%B3%C2%81%3B%13%C2%84A)%1A%C2%821%3C%C3%81%C2%9B%C3%81%C3%88%C3%86A%20%C2%8C%C3%A5%11%C3%84%C3%82B%12%C2%85%7C%C3%B8%C3%B6%C3%99%03(%C2%8C)%C2%82dF%11%243%C2%8A%20%C2%99Q%04%C3%89%C2%8C%22Hf%14A2%23%C2%85%20%07%00%04%C3%90%C2%89%08%00T%C3%BA%C2%BB%C2%95%0B%C2%80%3ARO%00%1D%C2%80f%22F%00%3B%00%C2%95%C2%88%20%C2%B7%C2%B2%14%C3%BF%22C%C2%8E%22r%C2%9E%C2%885p%C2%82N%C3%91%02%C3%A8HV%C3%A9%C2%87%C2%95'%C3%89%05%11%C2%91%1E%C3%80%C3%9A%C2%ABz%C2%8E4%7B%C3%92%02%C2%B8%C3%AC%C2%A9%C3%BD%C2%98%C2%B8%5Bp%C3%AB%C3%85%C3%9B%C3%94%C3%A3%C3%8C%C2%95%C2%A52%C3%84%C2%9F%C3%A0%5D%24%C2%BE%C3%B2%C3%AA%C3%8FZF%C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%C3%B4w%02%C2%B0%C3%96X%C2%AC%C2%BD%09%C2%BE%C3%9C%C2%912g%C3%BA%C3%B7%C2%9F%C2%81%C2%B7%C3%9F%C2%B8%C3%B6%0F%12K%C2%8Fa%C2%912%C3%9B~%2F%C2%A4%C2%A5X'%C2%99Q%04%C3%89%C2%8C%22Hf%14A2%C2%A3%08%C2%92%19E%C2%90%C3%8C(%C2%82dF%11%243%C3%BE%00Ou%C3%A4%C3%8B4%C3%8C%03%C3%BC%00%00%00%00IEND%C2%AEB%60%C2%82";
var image1 = win.add("image", undefined, File.decode(image1_imgString), {name: "image1"});

// GROUP1
// ======
var group1 = win.add("group", undefined, {name: "group1"});
group1.orientation = "row";
group1.alignChildren = ["left","center"];
group1.spacing = 10;
group1.margins = 0;

var button1 = group1.add("button", undefined, undefined, {name: "button1"});
button1.helpTip = "Click Quick!";
button1.text = "CREATE";

win.layout.layout(true);
win.layout.resize();
win.onResizing = win.onResize = function () { this.layout.resize(); }

if ( win instanceof Window ) win.show();

return win;

}());

Post Reply