在applescript中将"display dialog" window设为前面的window

Make the "display dialog" window the front window in applescript

我想显示一个对话框。这行得通,但它永远不是前面的window。我希望它更像是一个警示标志。所以当我想在对话框中输入文本时,我总是必须先点击它。有没有办法将对话框显示为最前面的 window 并将光标预设在文本字段中?这是我的代码:

display dialog "type password" buttons {"Submit!", "No"} default answer "" default button 1 with hidden answer

if the button returned of the result is "Submit!" then
    set x to text returned of the result
    if x is "Password" then
        tell application "Firefox"
            activate
        end tell
    else
        tell application "Finder"
            activate
            say "wrong password"
        end tell
    end if
else
    tell application "Finder"
        activate
        say "okay"
    end tell
end if

就在显示对话框指令之前,使用以下命令激活您的脚本:

tell me to activate