Activate script window...

Greetings!

Sometimes, after automatic launch of a script (such as described here), the script welcome window (standard dialog or alert) become out of focus, so it cannot be controlled from the keyboard right after window open.

Could you advice me any way to (re)activate dialog window in, for instance, 1 second after it has been opened please?

Unfortunately, the delay command doesn’t work for me. Even after 5 seconds pause before dialog display, the dialog window opens in unfocused state…
Moreover, the focus always stays on the application used prior to script launch. Therefore the alert/dialog seems not to get the focus at all.

Is there any workaround?

take a look at the last posts in this thread

Thank you Stefan!
As I understood, this is the magic command:

tell me to activate

Here I found a poor explanations of its logic:
http://books.google.com/books?id=rW5k0w_wC3MC&pg=PA452&dq=applescript+tell+me&hl=ru

Could you advice me any source of detailed information on “me” object please?

the best source is Apple’s AppleScript Language Guide

Thank you Stefan!
Now its working fine, but sometimes in 2-3 seconds after dialog open and stays activated somehow the focus is passed to a background application.
What can be a reason for such behaviour?
How to return the focus to the dialog?