Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"some script" is not allowed assistive access error on Mavericks

Tags:

applescript

I have a script I use for laying out windows on a multi-monitor setup. After upgrading to Mavericks, I'm getting an error:

Organize Windows is not allowed assistive access.

After checking Apple support, I found this: http://support.apple.com/kb/HT5914 I followed the steps described there, I signed the applet, without much success. The error still happens.

First of all, the second prompt only happens if the script was exported as an application and placed in /Applications, if I place it in Documents (also bundled like an app) for example it does not pop-up.

All applets appear as "applet" in System Preferences when they do show up (which is odd since they have an identifier).

Has anyone had any success running this kind of script? Is there a way to disable the security check globally? (I presume not, but it's worth to ask)

What follows is the script, it just launches a couple of apps and places them on the screen:

#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
like image 921
juancn Avatar asked Mar 22 '23 21:03

juancn


1 Answers

I was having exactly the same problem with a script app I wrote to deal with a minor audio glitch. I set it to start at startup, allowed it in Assistive Access, and signed it as you found on Apple Support, and it still gave me that error on every startup.

What finally fixed it for me was to copy and paste the script code into a new script file, saved it again as an application but with a different name, and signed it, all before I ever ran it. When I finally ran it, it asked me if I wanted to allow it in Assistive Access, which I did, then I set it to start at boot like before. I just got through a reboot and it ran without any problems.

like image 124
Red Five Avatar answered Apr 27 '23 08:04

Red Five