-
Extendscript. Assign a function to a button
Hi
Sorry if this is the wrong forum to post the question.
I have followed the extendscript tutorial series from David Torno. Really Great stuff.
I have manged to follow along and build the dockable GUI.
Here is the code:
// COMPLET BASE FOR MENU DOCKABLE
function myScript ( thisObj) {
function myScript_buildUI(thisObj ) {
var my panel = (thisObj instanceof Panel) ? thisObj: new Window("palette", "My GUI" undefined, {resizeable: true});
res = "group {orientation: 'row',\
groupOne: Group{orientation: 'column',\
minButton: Button{text: 'btn1'},\
minButton2: Button{text: 'btn2'},\
}";myPanel.grp = myPanel.add (res),
}
var myScriptPal = myScript_buildUI(thisObj);
If ( (myScriptPal !=null) && (myScriptPal instanceof Window){
myScriptPal.center();
myScriptPal.show ();
}
}
myScript(this);
A simpel menu with a group of 2 buttons in a single column.
I can’t figure out how to assign or associate an action when one clicks on the buttons.
Say when one click button2 and I wanted that a new comp were to be created:
var newComp= app.project.items.addComp("myNewComp",1920,1080,1.0,10,25);How do I assign that code to one of the buttons??
Cheers
/HRB