I have run this code in After Effects 22 using ExtendScript and I am new to all this.
This script adds a listbox with 2 buttons (add/remove).
My goal is:
- add textbox 2 textbox value = new solid
- click add button and add the string value of the button from the textbox
- Execute this code on click:
myComp = app.project.activeItem; mySolid = myComp.layers.addSolid([0,0,0], "Solid", myComp.width, myComp.height,1);
This will help me and from here I can build my own.
// ScriptUI Listboxes
var counter = 0;
var window = new Window("palette", "Listbox", undefined);
window.orientation = "column";
var listBox = window.add("listbox", undefined, []);
listBox.selection = 0;
listBox.size = [200, 100];
//app.project.label= ("ooooooooooooooooooo")
var buttonGroup = window.add("group", undefined, "buttonGroup");
buttonGroup.orientation = "row";
var addButton = buttonGroup.add("button", undefined, "+");
addButton.size = [30, 30];
var minusButton = buttonGroup.add("button", undefined, "-");
minusButton.size = [30, 30];
addButton.onClick = function () {
counter++;
listBox.add("item", "Item_"+counter.toString());
}
minusButton.onClick = function() {
if (listBox.selection != null) {
counter--;
listBox.remove(listBox.selection);
}
}
window.center();
window.show();