-
ScriptsUI: Closing Panels and Saving Data
Hey there,
I am having some issues being able to close a window launched from the Window menu inside of AE. My palette works successfully when launched from File > Scripts but for some reason it misbehaves when treated as a dockable item.
My code looks something like this:
var w = (thisObj instanceof Panel) ? thisObj : new Window("palette", "myscript");// window setup stuff here, including a cancel button.
cancelButton.onClick = function(){
w.close();
}w.onClose = function(){
alert("closing!");
}
When launched from File > Scripts, clicking the close button or the red “X” at the top of the widow triggers the “closing” message and closes the palette. When run from scripts UI, ESTK opens up and reports “w.close is undefined.”
This is mainly a problem because I am trying to store some data (a JSON file) when the script closes as to have a persistent set of information between sessions and uses. I’ve checked the ESTK and it appears that the Panel object does not have a .close() method, but I am unable to discern if this Panel object is describing the window panel or the ‘group’ panel. If I cannot close the palette for whatever reason, is there a work around for saving data when the user clicks the red X?
Thanks so much!
David
Relevant Tech info:
After Effects CC2014 (2014.2)
Mac OS X 10.9.5
Mac Pro (Late 2013)
Processor: 2.7 GHz 12-Core Intel Xeon E5
Memory: 32 GB 1867 MHz DDR3 ECC
Graphics: AMD FirePro D700 6144 MBDavid Conklin
Motion Designer