Mac - 列出终端中打开的窗口

时间:2012-04-12 13:16:55

标签: macos applescript osascript

我想列出终端中打开的窗口,以获得X11的x,y,宽度和高度,如xwininfo -root -tree

我试过了:

osacript -e tell application "Microsoft Word" to get the bounds of the front window

但它并不适用于所有应用程序而您无法指定子项(如果您有两个Word文档,则返回第一个打开的文档)。

1 个答案:

答案 0 :(得分:6)

获取所有窗口的位置:

osascript -e 'tell application "System Events" to get the position of every window of every process'

尺寸:

osascript -e 'tell application "System Events" to get the size of every window of every process'

标题:

osascript -e 'tell application "System Events" to get the title of every window of every process'

检查AppleScript编辑器中的参考以获取更多属性。

相关问题