Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions The script does not work in new versions of AE

  • The script does not work in new versions of AE

    Posted by Vasyl Iskovych on March 29, 2019 at 9:12 am

    Hello.
    I’m trying to figure out a little, in writing scripts.
    Who can help figure out what the problem is?
    I wanted to create a window with a button, by clicking on which,
    A window for entering text and another button opens.
    After entering the text and clicking on the second button,
    the window should close and appear “alert”.
    in EST, and in AE to CS6 it works.
    And in new versions, the second window closes once,
    and all subsequent clicks on the second button, it does not close.
    Video:
    https://www.youtube.com/watch?v=C02t-iOXsJs

    var mw1 = new Window("palette", "Form1", undefined);
    var mb1 = mw1.add ("button", undefined, "Button");
    var mw2 = new Window("palette", "Form2", undefined);
    var mtx = mw2.add ("edittext",undefined, " ", {multiline: true});
    mtx.preferredSize=[300,300];
    var mb2 = mw2.add ("button", undefined, "Button2");
    mw1.show();
    mb1.onClick = function myFun1(){
    mw2.show();
    }
    mb2.onClick = function myFun2(){
    mw2.close();
    if(mtx.text==0){alert ("No text!")}
    else
    {alert(mtx.text)}
    }

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

    Vasyl Iskovych replied 7 years, 1 month ago 2 Members · 5 Replies
  • 5 Replies
  • Oleg Pirogov

    March 30, 2019 at 12:41 pm

    I suppose, we’re not meant to show() closed windows. I guess, the only reason the window appears at all the second time is because it’s a palette which is know to remain in memory after being closed. Doing the same with a dialog will not result in window reappearing.
    And apparently you can’t close a window twice.

    So I would suggest using mw2.hide() instead of mw2.close(). That should work the way you want.

  • Vasyl Iskovych

    March 30, 2019 at 1:20 pm

    Thank you very much. Everything is working.

  • Vasyl Iskovych

    April 1, 2019 at 12:59 am

    Hello.
    I did not immediately notice, but the problem was not completely resolved.
    I changed “close ()” to “hide ()” and the window closes when I click the button. But when you click on the “closeButton” the window never closes.
    Help me please.

  • Oleg Pirogov

    April 1, 2019 at 5:17 am

    I suggest dynamical creation of the second window(s):

    var mw1 = new Window("palette", "Form1", undefined);
    var mb1 = mw1.add ("button", undefined, "Button");
    var mw2;
    mw1.show();

    mb1.onClick = function myFun1(){
    mw2 = new Window("palette", "Form2", undefined);
    var mtx = mw2.add ("edittext",undefined, " ", {multiline: true});
    mtx.preferredSize=[300,300];
    var mb2 = mw2.add ("button", undefined, "Button2");

    mw2.show();

    mb2.onClick = function myFun2(){
    mw2.close();
    if(mtx.text==0){alert ("No text!")}
    else
    {alert(mtx.text)}
    }
    }

  • Vasyl Iskovych

    April 1, 2019 at 7:36 am

    Thank you very much.
    You helped me a lot.

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