密码从不工作

时间:2014-02-15 04:06:58

标签: applescript

无论我的密码是什么,它总是说我的密码不对!请帮忙。这是脚本

set my_password to display dialog ¬

"Please enter your password:" with title ¬

"Password" with icon stop ¬

default answer ¬

"" buttons {"Cancel", "OK"} default button 2 ¬

with hidden answer

if (text returned of my_password) is no then

display dialog "Running the application!" buttons ["OK"] default button 1

else if (text returned of my_password) is not no then

display dialog "Did not enter correct password!" buttons ["OK"] default button 1

end if

1 个答案:

答案 0 :(得分:0)

您必须将密码(否)放在引号中。

我也缩短了剧本。试试吧:

display dialog "Please enter your password:" with title "Password" with icon stop default answer "" buttons {"Cancel", "OK"} default button 2 with hidden answer

if (text returned of result) is "no" then

    display dialog "Running the application!" buttons ["OK"] default button 1

else

    display dialog "Did not enter correct password!" buttons ["OK"] default button 1

end if