The big problem is that the onDeactivate event handler doesn’t work.
What has happened?
Adobe, please, fix this issue as soon as possible.
@Giorgio – we better discuss that in the scripting forum for InDesign:
To help you there we need to look at more code from you.
Something that is working in InDesign CS6 (or below) and now is broken (CC).
Maybe some of the moderators can move that thread over…