11.1. Scripting iTunes
The first iLife application you learn is how to script is iTunes. You learn how to play a song, list the songs in a playlist, adjust the volume, and so on. The next couple of Try It Out examples help you become more familiar with iTunes. This section is based on version 4.6 of iTunes.
11.1.1.
11.1.1.1. Try It Out: Examining the iTunes Dictionary
To begin scripting an application, look at the application's dictionary, if it has one. The iTunes application does have a dictionary, and you can look at it by following these steps:
Open the iTunes dictionary by dragging the iTunes icon onto Script Editor or by choosing FileOpen Dictionary from Script Editor's menu bar and then choosing iTunes.
Under iTunes Suite, select Commands. Take a look at some of the iTunes-specific commands shown in Figure 11-1.
Figure 11.1. Figure 11-1
Under iTunes Suite, select Classes and look at the application class to see its elements and properties. How can you tell if iTunes is playing a song? How can you adjust the volume setting of iTunes, and what are the possible values?
Look at the other iTunes classes. See if you can determine the relationship among the classes. Make sure you examine the following classes: source, playlist, and track. How do you find the playing time of a track? ...
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.