AppleScript: "Expected end of line, etc. but found identifier", Mavericks error?

StackOverflow https://stackoverflow.com/questions/23266980

  •  08-07-2023
  •  | 
  •  

Question

I have a short script that I started working on where I want Spotify to search for a specific song once an AppleScript is running, but I get this error that seems to be something that only Mavericks is whining about (after a short round of googling).

tell application "Spotify" to activate
delay 0.1
tell application "Spotify" to keystroke "l" using command down

It says

Syntax Error: Expected end of line, etc. but found identifier

and pointing to "using". Now, I've only been coding for a short period, but to my knowledge, this is the exact syntax that tons of people are using and have been posting to SO and other places.

Any ideas?

Cheers

Était-ce utile?

La solution

The command keystroke belongs to the Processes Suite. You can call it with System Events.

tell application "Spotify" to activate
delay 0.1
tell application "System Events" to tell process "Spotify"
    keystroke "l" using command down
end tell
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top