Search the Community
Showing results for tags 'system events'.
Found 2 results
Hi guys, wondering if anyone has a clue about what changed with applescripts and accessibility in macOS Sierra. Since upgrading to Sierra, it seems all of my workflows that use applescript no longer work. This is not exclusive to Alfred; I have tried running multiple scripts in Script Editor, and Script Editor ends up hanging on run. In Alfred 3, no information shows in debug. Calling a workflow will just cause Alfred to stop responding. Console does not show any Event errors in Alfred or Script Editor. I haven't been able to find similar issues with other people in google searches or in this forum. I have received some OS messages that I think may be involved as I've tried to run applescripts in both Alfred 3 and Script Editor (shown below). They seem to come up sporadically, and after a delay of running a script. I know it has been necessary to add SystemUIServer.app to Accessibility in System Preferences > Security & Privacy in past versions of Alfred and OS X in order to run certain workflows with applescripts. Since upgrading to Sierra, I am seeing a similar requirement. Adding /System/Library/CoreServices/SystemUIServer.app to Accessibility and checking it does not fix the issue. Any clues to what may be going on is much appreciated :). EDIT: I think it has something to do with "System Events." It looks like applecripts work until they come to tell application "System Events" I have tried adding /System/Library/CoreServices/System Events.app to Accessibility, a shot in the dark; that didn't help either.
Hi there, I'm absolutely new to applescript and writing alfred workflows. I want to write a workflow to connect to VPN with "Pulse Secure". Therefore I want to select the menu bar icon and select a connection. I managed to get it working when "System Events" is already running: on alfred_script(query) set network to "work network" if query is not "" then set network to query end if ignoring application responses tell application "System Events" to tell process "Pulse Secure" click menu bar item 1 of menu bar 2 end tell end ignoring do shell script "killall System\\ Events" delay 0.2 tell application "System Events" to tell process "Pulse Secure" tell menu bar item 1 of menu bar 2 tell menu item network of menu 1 click tell menu item "Connect" of menu network click end tell end tell end tell end tell end alfred_script If "System Events" is not running this script fails. I tried a couple of ways to start "System Events" if it's not running, but even with a delay afterwards it fails. I tried it with tell application "System Events" activate end tell with launch "System Events" delay 2 with http://apple.stackexchange.com/questions/95834/why-does-this-applescript-often-fail-the-first-time-but-always-work-after-that and a couple of other combinations. Unfortunately without success:( Hopefully you can help me a bit. Best regards