I wrote the following applescript to open a doc while also hiding some annoying persistent toolbars in my word processor app. It works great when I play directly from script editor. But when I turn it into an app, and try to play in Alfred (not Alfred 2), I get this:
Open "Bicycle" is not allowed assistive access. System Events got an error: Open "Bicycle" is not allowed assistive access. (-1719)
Oh, and I've tried more ordinary routes than "POSIX", but all bring the same result. Also, I'm running latest version of El Capitan.
tell application "Bean"
open POSIX file "/Users/MyDrive/Documents/Bicycle.rtf"
end tell
activate application "Bean"
delay 0.3
tell application "System Events"
tell process "Bean"
click menu item "Hide Ruler" of menu 1 of menu bar item "View" of menu bar 1
click menu item "Hide Status Bar" of menu 1 of menu bar item "View" of menu bar 1
click menu item "Hide Toolbar" of menu 1 of menu bar item "View" of menu bar 1
end tell
end tell