ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

The script does not work in new versions of AE

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Vasyl Iskovych
The script does not work in new versions of AE
on Mar 29, 2019 at 9:12:17 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:






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)}
}


Return to posts index

Oleg Pirogov
Re: The script does not work in new versions of AE
on Mar 30, 2019 at 12:41:37 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.


Return to posts index

Vasyl Iskovych
Re: The script does not work in new versions of AE
on Mar 30, 2019 at 1:20:02 pm

Thank you very much. Everything is working.


Return to posts index


Vasyl Iskovych
Re: The script does not work in new versions of AE
on Apr 1, 2019 at 12:59:37 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.


Return to posts index

Oleg Pirogov
Re: The script does not work in new versions of AE
on Apr 1, 2019 at 5:17:52 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)}
}
}


Return to posts index

Vasyl Iskovych
Re: The script does not work in new versions of AE
on Apr 1, 2019 at 7:36:10 am

Thank you very much.
You helped me a lot.


Return to posts index

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