For years, I've been using a really simple AppleScript to reset Music's AirPlay device back to my computer. I trigger it using a keyboard shortcut Command + E and the script doesn’t run. Same if I use the pointer to try from the Music → Scripts menu - it doesn’t run.

Here is my script in case that’s the problem :

tell application "Music"
    set newAirplayDevice to (get some AirPlay device whose kind is computer)
    set current AirPlay devices to {newAirplayDevice}
end tell

Lately (after upgrading to macOS 14, I think) when I trigger it through Music, I get an "AppleEvent timed out" error. However, the script still works as intended when I run it from Script Editor. This limits my ability to troubleshoot. Does this indicate there is a flaw in the script, or is it something in my system configuration?

  • What shortcut keys have you assigned to this script? You might need a third tool like FastScripts to see if the app is not launching it correctly or the script needs updating.
    – bmike
    Commented May 24 at 15:54
  • I have the script assigned to command+E using macOS system Settings. However, the error is the same whether I trigger it with the shortcut or I manually select it from the Scripts menu.
    – nigel
    Commented May 24 at 16:04

1 Answer 1


I would add permissions for music app to control access to the Automation preferences for Privacy & Security.

Then I would try FastScripts to capture the key shortcut and try its menu to execute the same script.

  • Thanks for helping me think through this. The issue was indeed related to Automation preferences. The script runs with FastScripts once I accept FastScripts' request to control Music. When I export the script as a standalone app and try to trigger in Music, it also asks permission and once I grant permission, it works. Unfortunately, I can't seem to find a way to grant appropriate permissions to the simple .scpt file, but the two solutions I listed above will work. Thanks!
    – nigel
    Commented May 24 at 17:09
  • Why do you want to grant permissions to a scpt file? (which you can't do, by the way). Not sure what else you're trying to do but you can run the .app file from the script menu.
    – Mockman
    Commented May 24 at 18:22
  • Wonderful Nigel! Onwards to more automation :)
    – bmike
    Commented May 24 at 18:45
  • @Mockman I understand—I guess I'd need to grant Music itself permission, since it runs the .scpt, which I also can't do. My reason for preferring this: Running a script file is quieter than running a script app, which launches in my dock and steals focus from Music for a split second while it runs.
    – nigel
    Commented May 24 at 18:58
  • That makes sense. However, it is not Music that would run the script. Generally, if you run it from script editor, then that is the app that requires access. If run via the script menu, then it should be SystemUIServer that runs the script — but that might depend upon your OS version. I'm not familiar with recent OS versions but you could likely look to see what 'server' (or similar process type) fires up at script launch using Activity Monitor or top in the terminal.
    – Mockman
    Commented May 25 at 0:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .