我想显示一个对话框。这是有效的,但它永远不是前窗。我希望它更像是一个警示标志。因此,当我想在对话框中输入文本时,我总是先点击它。有没有办法将对话框显示为最前面的窗口并将光标预设在文本字段中?这是我的代码:
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
答案 0 :(得分:2)
在显示对话框指令之前,使用以下命令激活脚本:
tell me to activate