11.5. Exercises

  1. The iTunes applet you developed in this chapter does not distinguish among multiple matching tracks with the same name. For example, you may have two tracks with the same name that were recorded by a different artist or on a different album. The user won't know that when presented with the list of choices. Modify the program so that each track provides the artist and album in the list of choices presented to the user (you can use the format name – artist – album) in the list.

  2. Modify the iTunes applet so that if an asterisk is entered for the song name a randomly selected track is played.

  3. Modify the iTunes applet so the three buttons labeled Title, Artist, and Album are offered to the user instead of OK, and Cancel. (Because display dialog only supports three buttons, you can't offer a Cancel button here.) The track should be selected from iTunes based on the button that is clicked. So, for example, if the user enters Springsteen and then clicks Artist, you display all tracks in the library playlist whose artist is Springsteen.

  4. As noted in the chapter, after you select a song, the next songs in your library continue to play. Implement the following strategy: Keep a playlist called Play Just One in your library. If the playlist doesn't exist, create it. Remove any previous track from the playlist, add the selected track, and then play it. After playing the single track, iTunes should stop playing. Note: You need to change the playlist property of the track reference ...

Get Beginning AppleScript® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.