Applescript等待模式消失
我正在编写一个脚本,为许多邮件生成PDF。因为生成PDF需要一些时间,所以我希望脚本等到 消失在邮件中。这样我就可以开始处理下一个了。以下是此元素的属性Applescript等待模式消失,applescript,Applescript,我正在编写一个脚本,为许多邮件生成PDF。因为生成PDF需要一些时间,所以我希望脚本等到 消失在邮件中。这样我就可以开始处理下一个了。以下是此元素的属性 由于它没有标题,如何指定等待此元素消失?您需要两个重复循环,一个等待工作表出现,另一个等待工作表消失 tell application "System Events" tell process "Mail" repeat until exists sheet 1 of window 1 del
由于它没有标题,如何指定等待此元素消失?您需要两个重复循环,一个等待工作表出现,另一个等待工作表消失
tell application "System Events"
tell process "Mail"
repeat until exists sheet 1 of window 1
delay 0.5
end repeat
repeat while exists sheet 1 of window 1
delay 0.5
end repeat
-- sheet was dismissed
end tell
end tell
您需要两个重复循环,一个等待工作表出现,另一个等待工作表消失
tell application "System Events"
tell process "Mail"
repeat until exists sheet 1 of window 1
delay 0.5
end repeat
repeat while exists sheet 1 of window 1
delay 0.5
end repeat
-- sheet was dismissed
end tell
end tell
如果Mail.app在第一个重复循环中意外退出或故意关闭,那么给第一个重复循环一个退出重复的机会可能不是一个坏主意。将这一行添加到
中,如果不存在(存在),则退出repeat--如果邮件在循环期间意外退出或关闭
,则将其添加到您的重复直到存在窗口1的第1页
事件中,如果出现此问题,应予以处理。如果Mail.app意外退出或故意关闭而仍处于第一个重复循环中,则为第一个重复循环提供退出重复的机会可能不是一个坏主意。如果不存在(存在),则添加此行,然后退出repeat--如果邮件在循环期间意外退出或关闭
,则添加到您的repeat until exists窗口1的第1页
事件中,如果出现该问题,应处理该问题。