I have an AppleScript applet which processes data then displays a dialog, waits 5 seconds, closes the dialog, processes new data then redisplays the dialog. It continues until there is no new data or it is quitted by the user.
The applet needs:
- the dialog to be displayed while the applet is visible.
- the dialog to not be displayed while the applet is not visible;
An objective is to enable the user to hide the applet. Therefore, code implements a rule that the dialog is displayed only if System Events reports the applet is visible.
The dialog is created with “display enhanced window” from Dialog Toolkit Plus and so is modal.
The applet works properly if it remains frontmost. However, if the user switches away from the applet or clicks on the Desktop, the dialog closes at the correct time but, does not redisplay. Instead, the applet’s icon bounces in the Dock until the user manually switches to the applet or clicks on the Dock icon. I’ve confirmed that at that moment the applet is visible according to System Events (even though there is no dialog and the applet’s menu is not visible).
I guess that because the dialog is modal it will insist on being frontmost. But, that is not happening. Is there a way to force an applet to display the dialog ?
Thanks.