谁知道如何使用AppleScript在邮件应用程序中使用搜索栏?我想使用邮件应用程序中的搜索栏自动搜索主题(而不是搜索整个邮件)的过程。由于我想搜索所有的邮箱(除了收件箱,还有其他智能邮箱),我不能使用常见的方法,即设置邮箱然后查看里面的所有消息。谢谢你的帮助。
发布于 2014-02-28 17:58:47
您可以使用一种称为GUI脚本的技术,它使您能够直接处理ui小部件并使用它们执行操作。
尝试这个脚本:(将搜索文本更改为您需要的内容)
activate application "Mail"
tell application "System Events"
tell process "Mail"
tell window 1
set search_text_field to text field 1 of the last group of tool bar 1
tell search_text_field
set the value of attribute "AXValue" to "subject:congratulations"
key code 36 -- press RETURN key
end tell
end tell
end tell
end tell(它适用于我的10.7,可能不适用于更新的操作系统)
发布于 2017-04-07 17:02:56
对我来说,这在约塞米蒂不起作用。我使用了以下解决方法:
activate application "Mail"
tell application "System Events"
tell process "Mail"
tell window 1
keystroke "f" using {command down, option down}
keystroke *your variable* as string
end tell
end tell
end tellhttps://stackoverflow.com/questions/22088360
复制相似问题