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.
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?