Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

applescript

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

like image 378
Erik Blomqvist Avatar asked Apr 24 '14 10:04

Erik Blomqvist


1 Answers

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
like image 85
user309603 Avatar answered Nov 10 '22 02:11

user309603