Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

AppleScript completely broken

Solved!

AppleScript completely broken

Device

MacBook Pro 16-inch 2021

Operating System

macOS Ventura 13.2.1 (22D68)

 

My Question or Issue

AppleScript seems completely broken. I can't even load the dictionary in AppleScript Editor, and this basic script doesn't work:

 

tell application "Spotify"

  play

end tell

I get:
error "The variable play is not defined." number -2753 from "play"

Reply

Accepted Solutions
Marked as solution

So open dictionary didn't work. I could choose Open Dictionary, select Spotify, then click Choose, and literally nothing would happen (other than the window closing). The dictionary for Spotify would NOT pop up.

 

Your alternate script didn't work either.

 

But then I dug in and found the underlying AppleScript definition file in Spotify, and strangely the simple act of directly opening it in Script Editor fixed it?!? I did the following:

 

  1. Right-click on Spotify.app and choose "Show Package Contents".
  2. Drill down to Contents/Resources/
  3. Choose "Open" in Script Editor
  4. Drag Spotify.sdef into the open dialog, and click Open

That opened the dictionary, and then everything worked after that. It seems like my computer somehow is failing to load the Spotify script definitions, but once I force it, it works?

 

To do it quicker, you could also do this from Terminal:

 

open -a /System/Applications/Utilities/Script\ Editor.app /Applications/Spotify.app/Contents/Resources/Spotify.sdef

 

So I have a workaround now, but I still have no idea what the root cause is, or even whether it's Spotify's fault or macOS's fault, or something else.

View solution in original post

2 Replies

Paw-some to see you ToastyKen!

I'm sorry to hear that you're having trouble with AppleScript.

Regarding the issue you mentioned, the error message you're receiving suggests that the "play" command is not recognized by the Spotify application, and therefore cannot be executed by AppleScript.

One possible solution is to check the Spotify dictionary to see if the "play" command is available. To do this:

  1. Open AppleScript Editor.
  2. Click on "File" in the menu bar, and select "Open Dictionary".
  3. In the "Open Dictionary" window, select "Spotify" from the list of applications, and click "Open".
  4. This should open the Spotify dictionary in AppleScript Editor. Look for the "play" command in the dictionary to confirm whether it is supported.

If the "play" command is not available in the dictionary, you may need to use a different command or approach to achieve the desired functionality.

Also if the "play" command is available, you can try modifying your script to explicitly reference the application's dictionary by using the "using terms from" block. For example:

 

using terms from application "Spotify"
    play
end using terms from

 

This should ensure that the "play" command is recognized by the Spotify application when the script is executed.

I hope this helps! Just a pup-date on your situation will do, thanks!

 

-Prague the Dog

Marked as solution

So open dictionary didn't work. I could choose Open Dictionary, select Spotify, then click Choose, and literally nothing would happen (other than the window closing). The dictionary for Spotify would NOT pop up.

 

Your alternate script didn't work either.

 

But then I dug in and found the underlying AppleScript definition file in Spotify, and strangely the simple act of directly opening it in Script Editor fixed it?!? I did the following:

 

  1. Right-click on Spotify.app and choose "Show Package Contents".
  2. Drill down to Contents/Resources/
  3. Choose "Open" in Script Editor
  4. Drag Spotify.sdef into the open dialog, and click Open

That opened the dictionary, and then everything worked after that. It seems like my computer somehow is failing to load the Spotify script definitions, but once I force it, it works?

 

To do it quicker, you could also do this from Terminal:

 

open -a /System/Applications/Utilities/Script\ Editor.app /Applications/Spotify.app/Contents/Resources/Spotify.sdef

 

So I have a workaround now, but I still have no idea what the root cause is, or even whether it's Spotify's fault or macOS's fault, or something else.

Suggested posts