osascript Expected end of line but found class name? Not really sure what its expecting here, I assume its around click button though. This used to work on 10.10.3, but seems to have stopped on 10.10.4? 

Script

function AcceptSecurity ()
{
osascript &lt;&lt;EOF
  tell application "System Events"
    repeat while exists (processes where name is "SecurityAgent")
      tell process "SecurityAgent"
        click button "Allow" group 1 of window 1
      end tell
      delay 0.2
    end repeat
  end tell
EOF
}


Exact error 165:170: syntax error: Expected end of line but found class name. (-2741)
The line


click button "Allow" group 1 of window 1



is missing an ‘of’

click button "Allow" of group 1 of window 1


If the button isn’t in a group, omit the group completely

click button "Allow" of window 1