0

I'm baffled by this. Any AppleScript which uses tell application "System Events" runs slow only on 1 account of my Mac but fine on the other account.

Just as a simple example, tell application “System Events” to display dialog “Hello World” displays the dialog almost instantly on account 1, but will take up to 6 or 7 seconds to display the dialog on account 2.

EDIT: Just to clarify, As user3439894 mentioned in the comment below. I understand that display dialog doesn't need to be called by System Events. This issue has nothing to do with display dialog. I'm using it as a simple example to demonstrate the issue. As I mention below ANY code I call inside system events is slow (eg. sent frontmost to true, click menu items, etc.).

Its only system event calls though. A simple display dialog “Hello World” or any other code that does not involve system events will run fast on both accounts.

A few more notes:

  1. It's not just display dialogs in tell application "System Events", it's ANY code I attempt to run in tell system events (e.g. click menu items, set frontmost to true, ect.). I'm just using the display dialog as a simple example.
  2. The delay is actually inconsistent. For example, with the display dialog command, most of the time it takes about 6 or 7 seconds for the dialog to appear, but occasionally the dialog will appear instantly. Other times, the dialog will appear instantly but then clicking the "OK" button will cause a 6 or 7 second delay (with the beachball).
  3. Both accounts on same Mac are admin accounts.
  4. The delay occurs in script editor, osascript, or apple script applications.

I'm lost. Any ideas?

EDIT 2 - More clarifications based on comments:

  • I've been trouble shooting this for several days and at this point I'm fairly certain of the following:

  • This has NOTHING to do with my code or how I am calling the script. It also is not AppleScript in general, or the account being slow.

  • Scripts NOT involving tell application "System Events" run fine on both accounts. Both accounts are generally running fast.

  • It's specifically tell application "System Events"on ONE account.tell application "System Events"runs fine on one of my user accounts. The SAME exact script, called the EXACT same way is taking 6 to 7 even 10 seconds to run on the second user account on the same computer. Both accounts have admin access.

11
  • display dialog is a part of Standard Additions and doesn't need to be, nor should it be, called by System Events! Simply use display dialog "Hello World". Check it out in the Library in Script Editor: ⇧⌘L Jan 29, 2021 at 2:37
  • Correct. The issue has nothing to do with 'display dialog', I'm using it as a simple example. As my post indicates, ANY code I call inside system events is slow. I'll edit my post to clarify.
    – jmrq
    Jan 29, 2021 at 11:10
  • How are you starting/calling/running the Applescript exactly? Jan 29, 2021 at 11:20
  • Hi Mark. This occurs no matter how I run the script. It occurs directly in ScriptEditor (pressing the "Run Script Button" or "command - R"), it occurs in bash scripts using osascript, and it occurs if I call the script directly on the command line (e.g. osascript /path/to/script.scpt).
    – jmrq
    Jan 29, 2021 at 11:28
  • 1
    Have you checked in Console to see if System Events is throwing errors there? It might help to run the command tell application "System Events" to set quit delay to 0. SE auto-quits after a short time; this will tell it to keep running indefinitely. Jan 29, 2021 at 16:28

1 Answer 1

1

@TedWrigley provided several recommendations in the comments of my main post that allowed me to identify the issue. So full credit goes to him! Thank you @TedWrigley! I'm posting here and marking this as the correct answer incase others encounter an issue similar to this.

EDIT: It was a specific Elgato Stream Deck Plugin; the Zoom Plugin!

Booting in safe-mode allowed me to initially identify that Elgato Stream Deck Software (VERSION 4.9.2) I have installed appeared to be causing the issues. I don't understand why that was interfering with System Events because SE did not appear to have any issues in Activity Monitor and I have the Stream Deck Software on both accounts, but it was only causing issues with System Events on one account.

After un-installing and re-installing that software, AppleScripts calling tell application "System Events" was running as expected on both accounts...

UNTIL I re-installed my plugins. I discovered that is was not actually the Stream Deck application itself that was interfering with System Events but a specific plugin, the Zoom Plugin V2.1 11/16/20 https://lostdomain.org/stream-deck-plugin-for-zoom/. I only use this plugin on one account which is why I was only seeing the System Event issue on that account.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.