Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Launch radio function in Spotify through applescript?

Hi all,



I'm trying to make a script that will start the radio function in spotify of the track that is currently playing

I'm gonna use it for a prototype in school project in interaction design, so it just have to work. Doesn't have to be elegant :-)


I've tried using accessibility inspector and looked at some GUI scripting tutorials for applescript, but it's still a bit above my coding skills

I tried to make it with automator as well, but the recording function doesn't seem to work with it

I've unlocked applescript, automator, finder and system events in system preferences so that they have permission to control the GUI, but can't get it to work






Any ideas? Struggling with the syntax here.



Tried this code, but i don't know how to access the context menu that appears when you right click on the track that is played:


tell application "Spotify"


activate

end tell


tell application "System Events"

tell process "Spotify"




clickmenu item "Start Radio" in menu bar



end tell

end tell

MACBOOK PRO (RETINA, 15-INCH, LATE 2013), OS X Mavericks (10.9)

Posted on Apr 23, 2015 11:21 AM

Reply
3 replies

Apr 23, 2015 11:36 AM in response to niklassc

UI actions might work, but you're missing a critical element:



clickmenu item "Start Radio" in menu bar

Menu items live within menus which, in turn, are part of the menu bar. So at the very least you need to tell the app which menu to click in. I don't use Spotify, but I would expect this command to look more like:


click menu item "Start Radio" of menu "Play" of menu bar 1


but there may be more to it.

Launch radio function in Spotify through applescript?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.