Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions refresh project.selection in script extendscript

  • refresh project.selection in script extendscript

    Posted by Rainier Raydán on June 14, 2017 at 5:59 pm

    Hi! I wrote a script that search for text layers in selected comp items and enable or disable them. Works fine but when I make another selection while the script interface is running it doesnt work… I want to launch the script and then do the selection… I dont want to make the selection before launch it. Any ideas?

    this is what I have:
    var proj = app.project;
    {
    function myScript(thisObj) {
    function myScript_buildUI(thisObj) {
    var myPanel = (thisObj instanceof Panel) ? thisObj : new Window("palette", "Textless_MOOCO_v01", [0, 0, 300, 300]);

    res = "group{orientation:'column', alignment:['fill', 'fill'], alignChildren:['fill', 'fill'],\
    panelOne: Panel{orientation:'row', alignChildren:['left', 'fill'],\
    onBtn: RadioButton{text:'on'},\
    offBtn: RadioButton{text:'off'},\
    },\
    }"

    // Adds resource string to panel
    myPanel.grp = myPanel.add(res);

    // Assign function to UI elements
    myPanel.grp.panelOne.onBtn.onClick = function(){
    if(proj.selection > 0){
    var textAry = getAllTextLayers (proj.selection);
    for(a=0;a 0){
    var textAry = getAllTextLayers (proj.selection);
    for(a=0;a

    Rainier Raydán replied 8 years, 11 months ago 1 Member · 1 Reply
  • 1 Reply
  • Rainier Raydán

    June 14, 2017 at 6:25 pm

    Sorry guys, it does work! I just edit this line
    proj.selection > 0

    to this:
    proj.selection.length <= 1

    Thanks!

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy