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.
Share
Source: http://tuaw.com/tag/AppleScript
var digg_url = 'http://digg.com/apple/Control_iTunes_with_AppleScript_using_e_mail'; Last week I talked about controlling your Mac with...
Add a Comment
I can see myself using this if I had a private Shoutcast stream that I wanted to control from another computer.
April 14 2008 at 9:24 AM Report abuse Permalink rate up rate down ReplyYou can also control everything on your computer with twitter:
http://www.maciverse.com/control-your-mac-with-twitter.html
Create Automator Tasks, save them as an app, and then launch them with an apple script + mail rule.
Cory - Are you hanging out in my closet?
http://murphymac.com/select-a-playlist-by-email-and-more/
http://murphymac.com/sleep-your-mac-by-email/
Don't get me wrong, I love these AppleScript blogs, but in what instance would this particular script be used. I can't think of any unless you are trying to gaslight a roommate.
April 13 2008 at 9:21 PM Report abuse Permalink rate up rate down ReplyYou can use this if you don't have an Apple remote or any way to control iTunes other than being directly in front of the computer. This would be great for someone who might have an Airtunes system set up with an Airport Express or AppleTV and want to change the track or playlist.
April 13 2008 at 9:25 PM Report abuse Permalink rate up rate down ReplyHot Apps on TUAW
Deals of the Day
more deals- Refurb Apple MacBook Air Laptops: 12" 64GB SSD for $699 + free shipping
- JVC Motion Sensing Clock Radio with Dual iPod Docks for $55 + free shipping
- Apple iPhone Headset with Mic for $4 + $2 s&h
- miFrame Picture Frame Dock for iPad for $64 + $8 s&h
- Refurb Apple iPod nano 8GB MP3 Player for $99 + free shipping, 16GB for $119
- Hannspree Apple-Shaped 28" 1080p LCD HDTV for $270 + free shipping
Software Updates
more updates- EFI Firmware Update brings Lion Internet Recovery to 2010-model Macs
- OS X Lion 10.7.3 released with Safari 5.1.3, Wi-Fi bug fix
- Aperture updated to 3.2.2, addresses Photo Stream issue
- Apple updates Keynote to address Lion issues
- Google Search app gets new look on iPad
- Apple releases Apple TV Software Update 4.4.3



5 Comments