我正在尝试编写一个AppleScript,它将清空Twitter for Mac的缓存,然后重新启动应用程序.我遇到的问题是确认对话框没有名称(标题栏为空)所以我迷失了如何在没有上下文的情况下定位按钮.这是我到目前为止所拥有的:
tell application "Twitter"
activate
end tell
tell application "System Events"
tell process "Twitter"
tell menu bar 1
tell menu bar item "Twitter"
tell menu "Twitter"
click menu item "Empty Cache"
end tell
end tell
end tell
end tell
end tell
tell application "System Events"
click button "Empty Cache" of window "Empty Cache?"
end tell
tell application "Twitter"
quit
end tell
tell application "Twitter"
activate
end tell
Run Code Online (Sandbox Code Playgroud)