Jump to content

strug

Member
  • Posts

    5
  • Joined

  • Last visited

Recent Profile Visitors

224 profile views

strug's Achievements

Helping Hand

Helping Hand (3/5)

0

Reputation

  1. mmh, does not work properly either. I saw that the flux workflow (http://www.packal.org/workflow/flux-control-plus-remote) do s.th. similar, but this workflow doesn't work on my machine either.
  2. Here is the link to the one suggesting to ignore/kill the System Events: http://stackoverflow.com/questions/16492839/applescript-on-clicking-menu-bar-item-via-gui-script
  3. If I don't ignore and kill that I have to wait ~7 seconds between open the menu bar 2 menu and selecting the submenu. I found somebody having a similar problem and his solution was to kill the "waiting". This works when System Events is already running, but not, when not. So if I remove the ignoring and kill stuff the workflow works, but have a ~7seconds pause before the submenu is selected. I tried to combine it: tell application "System Events" to tell process "Pulse Secure" click menu item "Connect" of menu network of menu item network of menu bar item 1 of menu bar 2 end tell but so far I couldn't manage it to work: [ERROR: alfred.workflow.action.applescript] { NSAppleScriptErrorAppName = "System Events"; NSAppleScriptErrorBriefMessage = "Can\U2019t get menu item \"work network\" of menu bar item 1 of menu bar 2 of process \"Pulse Secure\"."; NSAppleScriptErrorMessage = "System Events got an error: Can\U2019t get menu item \"work network\" of menu bar item 1 of menu bar 2 of process \"Pulse Secure\"."; NSAppleScriptErrorNumber = "-1728"; NSAppleScriptErrorRange = "NSRange: {499, 95}"; } Thanks so far
  4. Without ignoring the first menu opens but waits for ~7seconds, after that the submenu is opened and the entry get selected. No matter if System Events was running or not. To me it seems as if my script requires "System Events" to be running in order to run properly/quick. If it is not running, it will be started (I see that in the Activity Monitor), but my script did not wait for that (because of the ignore;) so that in that case it fails with a timeout/race condition. Any idea how I can speed up the workflow when removing the ignore? Thanks a lot!
  5. 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
×
×
  • Create New...