我想列出终端中打开的窗口,以获得X11的x,y,宽度和高度,如xwininfo -root -tree
。
我试过了:
osacript -e tell application "Microsoft Word" to get the bounds of the front window
但它并不适用于所有应用程序而您无法指定子项(如果您有两个Word文档,则返回第一个打开的文档)。
答案 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编辑器中的参考以获取更多属性。