我正试图通过Applescript访问Mac (我正在使用Yosemite)中的码头的实际大小。我在各种实现中找到了一些类似于这里的代码,但显然这是针对OS的。
tell application "System Events" to tell process "Dock"
set dock_dimensions to size in list 1
set dock_width to item 1 of dock_dimensions
set dock_height to item 2 of dock_dimensions
end tell我还在文档中进行了搜索,我指的是Mac脚本编辑器中附带的库。以下内容是从那里复制的:
dock preferences object n : user's dock preferences properties
animate (boolean) : is the animation of opening applications on or off?
autohide (boolean) : is autohiding the dock on or off?
dock size (real) : size/height of the items (between 0.0 (minimum) and 1.0 (maximum))
magnification (boolean) : is magnification on or off?
magnification size (real) : maximum magnification size when magnification is on (between 0.0 (minimum) and 1.0 (maximum))
minimize effect (genie/scale) : minimization effect
screen edge (bottom/left/right) : location on screen正如您所看到的,大小是列出的,但仅作为0到1之间的一个相对值。
但我需要像素大小,因为我想调整应用程序的窗口大小,因此我需要屏幕上的实际可用尺寸。(如果有人能给我一种方法来获得码头的最大和最小尺寸(这取决于显示),那就足够了,因为我可以计算当前的大小。
我也想知道一个人是否能得到脑膜的高度?
发布于 2015-01-18 11:31:12
我是AppleScript新手,没有足够仔细地阅读我收到的错误消息(忘了发布),这就是:
applescript editor is not allowed assistive access因此,要使这个脚本工作,必须在系统首选项的安全设置中赋予脚本编辑器权限。
https://stackoverflow.com/questions/28002994
复制相似问题