Skip to Content

WoW Insider is getting ready for BlizzCon!
AOL Tech

Filed under: Features, How-tos

AppleScript: Control iTunes with an e-mail

Last week I talked about controlling your Mac with an e-mail; this week, as promised, I am going to show you how to apply this same idea to iTunes. So, without further ado, let's get started with writing some AppleScripts.

Continue reading to learn how to control iTunes.

Creating the AppleScripts
For this tutorial, I am going to show you how to control iTunes in the following ways: open, play, stop, skip and play a specific playlist. Just copy whichever script you want to use from the list below and paste them into the Script Editor (Script Editor.app can be found in ~/Applications/AppleScript/ Script Editor).

Open / Play iTunes
tell application "iTunes"
activate
play
end tell

Stop Playing
tell application "iTunes"
stop
end tell


Skip Track
tell application "iTunes"
next track
end tell

Start playing a specific playlist
tell application "iTunes"
set the_playlist to user playlist "typenameofplaylisthere"
set view of front window to the_playlist
play the_playlist
end tell

Additional Information
For the "Start playing a specific playlist" AppleScript, you need to define a playlist in the "typenameofplaylisthere" section -- remember to retain the quotation marks around the name as well as type the playlist name exactly as you see it in iTunes. For instance, if I wanted to use the Party Shuffle playlist, I would type "Party Shuffle" in this line.

Saving Your Scripts
You can now save your Apple Script in the format you want. You can also use this script to change tracks or load a new playlist by e-mail. Just follow the instructions in last weeks post to learn how to do this.

Mac Automation posts are published weekly here on TUAW, be sure to come back next week for more AppleScripty goodness.

Reader Comments (Page 1 of 1)

Tip of the Day

To find out what version of Mac OS you are running, go to the Apple logo in the top left corner, click it and choose About This Mac. From that window you will see the version number, processor, memory and chosen startup disk. Clicking Software Update will check for updates, and More Info... will open up an extensive list of everything on your machine.


Follow us on Twitter!
TUAW [Cafepress]

Sponsored Links

Featured Galleries

DNC Macs
Macworld 2008 Keynote
Macworld 2008 Build-up
Google Earth for iPhone
Podcaster
AT&T Navigator Road Test
Bento for iPhone 1.0
Scrabble for iPhone
Tom Bihn Checkpoint Flyer Briefcase
Apple Vanity Plates
Apple booth Macworld 07
WorldVoice Radio
Quickoffice for iPhone 1.1.1
Daylite 3.9 Review
DiscPainter
Mariner Calc for iPhone
2009CupertinoBus
Crash Bandicoot Nitro Kart 3D
MLB.com At Bat 2009
Macworld Expo 2007 show floor
Apple Texas Hold 'Em

 

More Apple Analysis

AOL Radio TUAW on Stitcher