How to periodically show alert message *in foreground*? I want to have an alert / dialog box to fire up periodically in foreground.

I tried a combination of AppleScript and launchd and managed to have the script (actually converted to a app) fired up periodically via launchd. However, the alert box does not show up in front of all other windows (rather totally hidden until I tab to it – though it does get started via launchd). How can I get it in front?

My script is as follows:

on run
    activate me --&gt; tried to get alert in foreground
                --&gt; didn't help, though
    display alert "Should show up in foreground..."
end run


My launch.plist is (in /Users/bernhard/Library/LaunchAgents/):

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;bernhard.sitstraight.plist&lt;/string&gt;

    &lt;key&gt;Program&lt;/key&gt;
    &lt;string&gt;/Users/bernhard/programming/periodic.app/Contents/MacOS/applet&lt;/string&gt;

    &lt;key&gt;RunAtLoad&lt;/key&gt;  
    &lt;true/&gt;

    &lt;key&gt;StartInterval&lt;/key&gt;
    &lt;integer&gt;1200&lt;/integer&gt;
&lt;/dict&gt;
&lt;/plist&gt;
Try using open instead of launching the program directly. open more closely matches double-clicking to launch the AppleScript application.

open your application

To do this, replace the Program key value pair in your launchd job ticket with a ProgramArguments array to provide the path to your AppleScript application:

&lt;key&gt;ProgramArguments&lt;/key&gt;
&lt;array&gt;
    &lt;string&gt;/usr/bin/open&lt;/string&gt;
    &lt;string&gt;/Users/bernhard/programming/periodic.app&lt;/string&gt;
&lt;/array&gt;


By default, the open command attempts to bring the launched application to foreground.