*This article is an original research by TerribleJunkShow.
Original usage of Window.children
Based on a blueprint called Window, write
var myW = new Window(…)
to create a new window.
Then, to add buttons, etc., write
Window.children means “the children that the window you created has.
If you write myW.children, you will get the buttons, etc. for the window you created.
However, Window.children seems to have a meaning other than the above.
Another meaning of window.children
It appears that the window itself that you created, i.e., the script window or UI panel that you loaded into AE, is contained in Window.children.
It means that a script window or panel is a child of Window, the blueprint.
From there, using several for statement searches, you will find the button for the corresponding script.
(All kinds of UI parts can be searched, not only buttons)
Applying the onClick or click event to that button allows remote control of the corresponding script button.
There are a few things to note.
For the UI panel, the parent of the script is an object called Workspace.
And apparently, writing “instanceof Workspace” sometimes results in an “undefined” error.
Presumably, once the script window is erased, the code associated with the button is gone from memory.
For more information, please see the source code of my script “BtnHook”.
Notes (most important)
For authors of paid scripts who have created their own system for activation and trial versions
When the license authentication does not pass, or when the trial period has expired,does your system implement a process such as “buttons are displayed but covered by a panel to disable them”?
If buttons are displayed, users can remotely control your script buttons in the manner described above.
It may be better to change the implementation to “do not display”, i.e., “do not create the window if the authentication does not pass”.