AE CC2017.1 script terminates itself upon some hidden Modal Dialog error
I am trying to find a solution to this: I have a script which is part of my saved active workplace as tiny tall docked panel on left side of my Timeline that automatically detects all the markers in main comp (activeItem), make ListBox out of them which updates itself on the run (so any change to the actual markers is automatically reproduced in the ListBox, even reordering, renaming etc.) so by clicking on any of them my timeline jumps to the specific marker.
Everything works great except one strange situation that I am unable solving and I think it cannot be solved script-wise: with one really huge project having 850+ active layers (music video) which is opening for about 30 seconds it simply does nothing - no update to ListBox, it stays "deaf". So I manually close the panel and upon re-opening it it pops up error message saying "Can not run a script while a modal dialog is waiting for response". So when I close it once again and reopening it everything works again as expected: all the markers are updated in the ListBox and the script works flawlessly...
Once again: prior this there was no visible Modal Dialog being opened waiting for some user interaction whatsoever, just simple opening of a big project file that opened without any error.
Does anyone know why is this happening and how to possibly solve this?
I also think IT CANNOT BE SOLVED VIA SCRIPT as the script itself is immediately terminated as soon as the Modal Dialog error happens thus it cannot evaluate that such error happened as it is already in stop mode, LOL (hope it does make sense to you guys).
I would think about some kind of application-wise setting or maybe some MOD/"hack" to AE itself but have no clue what or how to do it, any suggestions, please?
EDIT:
Using this simple script I was able at least detect that some error actually occurred:
function err(errString)
{
alert(errString);
}
app.onError = err;
But I cannot get any further as it seems that the actual error dialog window is somewhere out there but do not show up at all, only after I manually close my panel and re-open it only then that error dialog about "...Modal Dialog waiting for response" appear.
So if it does not show up it still waits for the OK button to be clicked I guess: is there some way how to virtually click that error dialog OK button (as the dialog itself do not show up as I said earlier above)? Or is there some option to force AE showing that hidden error dialog that is for some reason hidden but still there?
I even undocked all the panels to see if it is not somewhere behind them but it is not, simply that error occurs but is not shown, strange isn't it? 😞
Maybe if there was some way how to - via script - close and re-open the docked panel itself when it detects the error using the function above, that way I could reproduce my manual solution as the error dialog only appear after the panel is closed (once reopened it immediately works as expected once again) - BUT HOW TO DO THAT (if it is possible at all in the first place)?
EDIT 2:
So the option with possible script-wise closing/re-opening of the panel DOES NOT SOLVE ANYTHING, it actually do not work at all as it for some reason completely ignoring the "working" part of the script: it close & reopens panel itself but it does not fill its ListBox with markers - it does nothing at all, just rebuilds the panel and empty ListBox window without showing that hidden Modal Dialog error message!
The script for that is this:
// Navigator.jsx is my script file
app.executeCommand(app.findMenuCommandId("Navigator.jsx"));
Also it does not work when called directly from the err function like this:
function err(errString)
{
alert(errString);
app.executeCommand(app.findMenuCommandId("Navigator.jsx")); // 1. close panel
app.executeCommand(app.findMenuCommandId("Navigator.jsx")); // 2. reopen panel
}
app.onError = err;
With the code above nothing happens, but when I run that app.executeCommand line using fx-Toolbar2 panel it closed/reopened the panel (tho internal ListBox marker script section was not working at all as I said above, unfortunately).
It really looks that only real manual closing and re-opening of the panel works, but why?
EDIT 3:
I noticed that in err function which is called upon app.onError some code works (basically some elementar-like stuff) and some not. For example:
- alert(); - works as expected
- ListBox.removeAll(); - works as expected //<-- this would clear the ListBox window
- app.cancelTask(checkTask); - DOES NOT WORK! //<-- there is my initial/normal "var checkTask = app.scheduleTask("check();", 2000, true);" outside this function
- var checkTask = app.scheduleTask("check();", 2000, true); - DOES NOT WORK!
- var createSomeNewTask = app.scheduleTask("check();", 2000, true); - DOES NOT WORK!
Can anyone here additionally explain this to me like why is it so? Or even better how/what code to use in the err function that would re-run my app.scheduleTask(); section of the script?
UPDATE:
Now this is absolutely crazy: I was able to slash it down as much as possible to still giving me the Modal Dialog error so now it has like 30 comps (compared to previous 850+ active layers), but now from 10 times I run the project it occurs randomly?!?!?!?!?!?!?!?!?!?!
Like 4 out of 10 times, next it is 7 out of 10 times, then 2 out of 10 times - WHAT THE HACK IS GOING ON HERE, ADOBE?! This way I am unable find out where the problem is...!