我有一个脚本,用于在多监视器设置上布局窗口。 升级到小牛后,我发现了一个错误:“某些脚本”不允许小牛的辅助访问错误
Organize Windows is not allowed assistive access.
检查苹果的支持后,我发现这一点: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
Upvote。节省了我的时间。 – Ilan
尝试运行'sudo sqlite3/Library/Application \ Support/com.apple.TCC/TCC.db“SELECT * FROM access”'查找为不工作的脚本添加的辅助访问条目。您应该看到类似于'kTCCServiceAccessibility | com.apple.ScriptEditor.id。<您的应用程序的名称>一行'| 1 | 1 | 1 |'一旦找到它,可以使用'sudo sqlite3/Library/Application \支持/ com.apple.TCC/TCC。db“DELETE FROM access WHERE client ='com.apple.ScriptEditor.id。<您的应用程序的名称>'”'。签署应用程序,运行它,并希望它没有重命名它的工作。 –