我正在尝试创建一个小的AppleScript来创建并在我的屏幕上移动一些终端窗口.我遇到的问题是,在某些情况下,似乎OS X忽略了我设置的界限.
使用AppleScript编辑器:
tell application "Terminal" to set the bounds of the first window to {0, 50, 600, 700}
tell application "Terminal" to get the bounds of the first window
Run Code Online (Sandbox Code Playgroud)
在事件日志中显示以下内容:
tell application "Terminal"
activate
set bounds of window 1 to {0, 50, 600, 700}
get bounds of window 1
--> {0, 22, 600, 672}
end tell
Result:
{0, 22, 600, 672}
Run Code Online (Sandbox Code Playgroud)
目视检查脚本运行时创建的窗口,显示结果边界是窗口使用的边界.
有任何想法吗?
编辑:运行10.6.3.我的屏幕大小为1280 X 800. Finder将桌面窗口的边界报告为{0,0,1280,800}
有时当告诉应用程序设置边界不起作用时,告诉系统事件更改位置和大小属性可以:
tell application "System Events" to tell process "Live"
set position of window 1 to {0, 50}
set size of window 1 to {600, 650}
end tell
Run Code Online (Sandbox Code Playgroud)
我今天遇到了同样的问题。不确定真正的原因是什么,但解决方法是在设置边界后添加额外的“设置位置”:
# from my window tiling script:
set the bounds of the first window to {0, 22, (screenWidth / 2), screenHeight}
set position of the first window to {0, 22}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7877 次 |
| 最近记录: |