我有一個腳本,用於在多監視器設置上佈局窗口。 升級到小牛後,我發現了一個錯誤:「某些腳本」不允許小牛的輔助訪問錯誤
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。<您的應用程序的名稱>'」'。簽署應用程序,運行它,並希望它沒有重命名它的工作。 –