我有一个脚本,用于在多显示器设置中布置窗口。升级到 Mavericks 后,出现错误:
Organize Windows is not allowed assistive access.
检查Apple支持后,我发现: http: //support.apple.com/kb/HT5914 我按照那里描述的步骤,签署了小程序,但没有多大成功。错误仍然发生。
首先,仅当脚本作为应用程序导出并放置在 /Applications 中时才会出现第二个提示,如果我将其放置在 Documents(也像应用程序一样捆绑)中,例如它不会弹出。
当所有小程序出现时,它们都会在系统偏好设置中显示为“小程序”(这很奇怪,因为它们有一个标识符)。
有没有人成功运行这种脚本?有没有办法全局禁用安全检查?(我想不是,但值得一问)
下面是脚本,它只是启动几个应用程序并将它们放在屏幕上:
#Query desktop area
tell application "Finder"
set displayAreaDimensions to bounds of window of desktop
set widthOfDisplayArea to item 3 of displayAreaDimensions
set heightOfDisplayArea to item 4 of displayAreaDimensions
end tell
tell application "System Events" to tell process "Dock"
set dockPosition to position in list 1
set dockDimensions to size in list 1
set heightOfDock to item 2 of dockDimensions
set positionOfDock to item 2 of dockPosition
end tell
# Space between windows
set padding to 7
# This assumes that the Apple Cinema Display 27" is to the right
# of the Macbook Pro
set idea_w to 1600
set idea_h to 1440
set idea_base_x to 1680
set iterm_w to 2560 - idea_w - padding
set iterm_h to 1000
set iterm_base_x to idea_base_x + idea_w + padding
#If we're in a single monitor configuration
if widthOfDisplayArea is 1680 and heightOfDisplayArea is 1050 then
# Override sizes
set idea_base_x to 0
set iterm_base_x to 0
set idea_w to widthOfDisplayArea
set idea_h to (heightOfDisplayArea - heightOfDock)
set iterm_w to 1024
set iterm_h to (heightOfDisplayArea - heightOfDock)
end if
checkRunning("IntelliJ IDEA 11", 10)
checkRunning("iTerm", 0)
placeWindow("IntelliJ IDEA", idea_base_x, 0, idea_w, idea_h)
placeWindow("iTerm", iterm_base_x, 0, iterm_w, iterm_h)
#Helper to launch as necessary
on checkRunning(theName, theDelay)
if application theName is not running then
tell application theName to activate
delay theDelay
end if
end checkRunning
on placeWindow(theProcess, x, y, w, h)
tell application "System Events" to tell process theProcess
set allWindows to (every window)
repeat with aWindow in allWindows
set position of aWindow to {x, y}
set size of aWindow to {w, h}
end repeat
end tell
end placeWindow