Applescript太慢,无法做任何事情,并保持超时

时间:2012-08-28 08:47:59

标签: events timeout applescript

有人可以说明为什么脚本突然变得如此缓慢?

即使这个测试脚本在120秒超时之前也没有完成。

tell application "Mail"
set selectedEmails to get selection -- returns a list
end tell

1 个答案:

答案 0 :(得分:0)

这可能是您系统的问题。该脚本不需要太多时间在我的计算机上执行。

set time1 to do shell script "perl -e 'use Time::HiRes qw(time); print time'"
tell application "Mail" to set selectedEmails to get selection -- returns a list
set time2 to do shell script "perl -e 'use Time::HiRes qw(time); print time'"
set millisec to (round ((time2 - time1) * 1000))
return "Emails:" & (count of selectedEmails) & " Milliseconds:" & millisec

“电子邮件:1000毫秒:183”