ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Listbox .selectedItem, .selection, .??????

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Scott McGee
Listbox .selectedItem, .selection, .??????
on Apr 4, 2017 at 3:24:07 pm

I have a listbox, I want to be able to take the value from a selected item, hit my apply button and it will put the value into my text layer. I've tried .getDisplayedItem, .selectedItem, .selection, .prettyMuchAnythingICanFindOnline.

The only one that has brough back anything is myList.selection, which brings back "NULL", everything else either brings back Null is not an object, or it does nothing. Any suggestions?

//BTN: to apply selected listbox item
var myBtn = w.add ("button", undefined, "Apply");
var myComp = app.project.activeItem;
var Text1 = myList.selection;
myBtn.onClick = function(){
myComp.layer("Amount").property("ADBE Text Properties").property("ADBE Text Document").setValue(Text1);
}


Return to posts index

Dan Ebberts
Re: Listbox .selectedItem, .selection, .??????
on Apr 4, 2017 at 6:16:50 pm

In your onClick function, I think this.selection.text should give you the text you want.


Dan



Return to posts index

Scott McGee
Re: Listbox .selectedItem, .selection, .??????
on Apr 5, 2017 at 8:25:51 am
Last Edited By Scott McGee on Apr 5, 2017 at 9:01:39 am

Hey Dan,

Thanks for the response, but I couldn't get that too work. I did get another response from the adobe forum with the below. This works, but I forgot the crucially mention that Column 1 is set up from an Array. I managed to fix that aswell, but I can't seem to get the info I want from column 2.

//BTN: to apply selected listbox item
var myBtn = w.add ("button", undefined, "Apply");

myBtn.onClick = function(){

var myComp = app.project.activeItem; if(!myComp || myComp.typeName !== "Composition") return;
var Text1 = myList.selection[0].text;
var Text2 = "Column 2"
var textValue = myComp.layer(""+Text1+"").property("ADBE Text Properties").property("ADBE Text Document").value;
textValue.text = Text2;
myComp.layer(""+Text1+"").property("ADBE Text Properties").property("ADBE Text Document").setValue(textValue);
}


Return to posts index


Scott McGee
Re: Listbox .selectedItem, .selection, .??????
on Apr 5, 2017 at 12:11:01 pm

Got the answer (ish), need too fine tune, but it does what I need.

//BTN: to apply selected listbox item
var myBtn = w.add ("button", undefined, "Apply");

myBtn.onClick = function(){

var listSel = myList.selection;
var myComp = app.project.activeItem; if(!myComp || myComp.typeName !== "Composition") return;
var n;

for (n=0; n var Text1 = listSel[n].text;
var Text2 = listSel[n].subItems[0].text

var textValue = myComp.layer(""+Text1+"").property("ADBE Text Properties").property("ADBE Text Document").value;
textValue.text = Text2;
};

myComp.layer(""+Text1+"").property("ADBE Text Properties").property("ADBE Text Document").setValue(textValue);
};


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]