Thanks for the help to convert this one:
(or is there a plugin for selecting specific iTunes numbers/radio stations?)
tell application "iTunes" to play (first track of playlist "Radio" whose name is "Sky Radio 101 FM")
we expect that you won't be able to embed AppleScripts any more, so the only way to execute them will be via an external script file
McJohn wrote:It this script possible in Python?
import subprocess
command = ['osascript', '-e', 'tell application "iTunes" to play first track of playlist "Radio" whose name is "Sky Radio 101 FM"']
p = subprocess.check_output(command)
import applescript
script_source = 'tell application "iTunes" to play (first track of playlist "Radio" whose name is "Sky Radio 101 FM")'
script = applescript.AppleScript(source=script_source)
reply = script.run()
jay (support) wrote:I'm not sure if the new iTunes Local Control plugin supports that level of specification, but it might. He's using the py-applescript library to do the work in that plugin as well.
Colorado4Wheeler wrote:McJohn wrote:It this script possible in Python?
The only way you'll get that in "Python" is if you use the Python AppleScript library to run it, or you can alternatively running it using subprocess to execute osascript since it's just a simple one line script:
- Code: Select all
import subprocess
command = ['osascript', '-e', 'tell application "iTunes" to play first track of playlist "Radio" whose name is "Sky Radio 101 FM"']
p = subprocess.check_output(command)
The problem is that iTunes commands are AppleScript specific mostly. I'm actually playing with a new plugin to work with iTunes under the new AppleScript-free model but it's just in the beginning phases.
import subprocess
command = ['osascript', '-e', 'tell application "iTunes" to play first track of playlist "Radio" whose name is "Sky Radio 101 FM"']
p = subprocess.check_output(command)
tell application "iTunes"
return shuffle enabled
end tell
tell application "iTunes"
return shuffle enabled
end tell
McJohn wrote:It gives a syntax error (Expected end of line but found property).
McJohn wrote:ScriptError: Expected end of line, etc. but found property. (-2741) range=85-92
McJohn wrote:iTunes 12.3.2.35 (12.7.4 won't work on this OS)
Users browsing this forum: No registered users and 3 guests