Applet bounces in Dock instead of showing dialog

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.

If you add:

“tell me to activate”

Just before the dialog that should bring the applet to the front.

Ed, many thanks.

That’s the best idea I’ve seen. It’s not ideal as it results in the dialog noticeably blinking between redisplays. Without that, there is almost no distinguishable gap between updates.

What I really would like is for the applet’s dialog to be visibly updating without being frontmost. More work needed.

Cheers.