我想从命令行运行一个applescript脚本,并在其中运行一个循环,直到收到一条消息。收到消息时,我正在使用以下方法更新变量:
using terms from application "Messages"
on message received theMessage from targetBuddy
set gotMessage to true
end message received
end using terms from
但是,当我将它放在on run块中时,我收到一条错误on message received消息,提示“预期“结束”,但发现“开启”。当我将它放在运行块之外时,脚本可以保存并运行,但是没有调用 on message received 处理程序,我通过log在其中抛出一个语句来检查它。如何让脚本在运行另一个循环的同时检查收到的消息?