Question: is it possible to have extensions without a UI, or with an optional UI? I've managed to come close to getting this to work, but it seems to remain just beyond my grasp. This is using InDesign.
What I want to achieve:I want the extension to run at all times so it can listen for documentAfterSave events even when the panel is not showing, and I want to have the 'panel visible' state persist across user sessions.
The first thing was to get the extension to load on app startup.
In the Lifecycle panel in the manifest editor, I unchecked 'AutoVisible' (not sure whether that was important)
Then I added the applicationActivate event to the list of 'StartOn' events.
That makes my extension shows up when the app starts. Cool.
But I want to be in control of the panel visibility - i.e. if the user had the panel hidden when he last used the app, I want the extension to be hidden when the user launches the app at a later time.
I.e. I want to save the 'visible' state for the extension panel between user sessions. I tried saving and restoring the visible state via the CSXSInterface.instance.whatchamacallit stuff, and I tried listening for state change events for WINDOW_SHOW and WINDOW_HIDE, so I could keep track and safeguard the panel's visibility state, but it looks like those events don't really work (see Harb's bug list elsewhere on this forum). I also tried moving the panel off-screen to simulate being hidden (old trick, didn't work).
Before I give up and try a different approach (without extension builder), does anyone know whether this can be made to work?
Another lingering doubt: suppose I got it to work, how good is the documentAfterSave event? For example, when the user closes an unsaved document, and then agrees to save the document when alerted ('Do you want to save...' dialog).
Will the event fire early enough so I can still extract information from the document before InDesign starts tearing down the document data structures? Or will I end up in the twilight zone, where merely accessing the half-disassembled document object can cause crashes? Or will I find the document has already been closed from before the event fired?