小编Tys*_*age的帖子

使用AppleScript如何在没有名称/标题的窗口中单击对话框中的按钮?

我正在尝试编写一个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)

twitter macos applescript

9
推荐指数
1
解决办法
2万
查看次数

标签 统计

applescript ×1

macos ×1

twitter ×1