"某些脚本"不允许小牛队的辅助访问错误

jua*_*ncn 4 applescript

我有一个脚本,用于在多显示器设置上布置窗口.升级到Mavericks后,我收到一个错误:

Organize Windows is not allowed assistive access.
Run Code Online (Sandbox Code Playgroud)

在检查Apple支持后,我发现了这个:http://support.apple.com/kb/HT5914 我按照那里描述的步骤,我签署了applet,没有太大的成功.错误仍然发生.

首先,第二个提示只有在脚本作为应用程序导出并放在/ Applications中时才会发生,如果我将它放在Documents中(也像app一样捆绑),例如它没有弹出.

当所有applet显示时,它们在"系统偏好设置"中显示为"applet"(由于它们具有标识符,因此很奇怪).

运行这种脚本有没有人有任何成功?有没有办法全局禁用安全检查?(我猜不是,但值得问)

接下来是脚本,它只是启动了几个应用程序并将它们放在屏幕上:

#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
Run Code Online (Sandbox Code Playgroud)

小智 6

我写的一个脚本应用程序与处理一个小音频故障时遇到了完全相同的问题.我将它设置为在启动时启动,允许它在辅助访问中,并按照您在Apple支持上找到的那样进行签名,并且它仍然在每次启动时都给我错误.

最后为我修复的是将脚本代码复制并粘贴到一个新的脚本文件中,再次将其保存为应用程序,但使用不同的名称,并在我运行它之前对其进行签名.当我最终运行它时,它问我是否想在Assistive Access中允许它,我做了,然后我将它设置为像之前一样启动.我刚刚完成重启,它运行没有任何问题.