|
|
#1 |
|
Play Specific Song in iTunes Applescript
I have created a simple applescript to play a specific song in iTunes, play a random song, or play a playlist named "Sleep". I am having an issue with the random song function, where "play (next song)" is not playing the next song. Also, is there a better way to throw the error message at the bottom? If the text entered is part of the name of a song, then the song will play but then the error will come up anyway because there isnt a song that is named exactly what was typed in. Also, is there a way to create a choosable list of "results" so if there is more than one result you could choose the song you want? Sorry for asking so many questions, but I'm lost. Thanks everyone! Here's the code:
repeat tell current application set song to the text returned of (display dialog "What song would you like to play? Or random?" default answer "") end tell tell application "iTunes" if song is "Random" or song is "random" then try set all_music to user playlist "Music" set shuffle of user playlist "Music" to false set shuffle of user playlist "Music" to true if current playlist is not "Music" then play user playlist "Music" else --FIX THIS play (next track) end if set shuffle of user playlist "Music" to false set shuffle of user playlist "Music" to true end try end if if song is "sleep" or song is "Sleep" then try set the_playlist to user playlist "Sleep" set shuffle of the_playlist to true if current playlist is not the_playlist then play the_playlist else play (next track) end if end try end if if song is not "Random" and song is not "random" and song is not "sleep" and song is not "Sleep" then try play track song on error errMsg number errorNumber try set results to (every file track of playlist "Library" whose name contains song) repeat with t in results play t end repeat end try end try if file track song in playlist "Library" exists then try end try else tell current application display dialog "Cannot locate song." end tell end if end if end tell end repeat |
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| thread | Thread Starter | Forum | Replies | Last Post |
| No songs in itunes | rickf78 | iMac | 0 | Nov 5, 2010 02:53 AM |
| Can you just play a song in iTunes without importing it? | Tumbleweed666 | Mac Applications and Mac App Store | 8 | Apr 13, 2009 05:31 PM |
| Listening to Artist/Album Specific Songs in iTunes | superspiffy | Mac Applications and Mac App Store | 3 | Sep 8, 2008 03:45 PM |
| play single song in iTunes/automatic folder creation | xpipe | Mac Applications and Mac App Store | 4 | Jul 9, 2008 10:04 PM |
| can I play VLC songs in itunes | wnameth | General Mac Discussion | 4 | Jan 30, 2005 02:23 PM |
All times are GMT -5. The time now is 10:36 AM.






Linear Mode

