Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Getting iTunes to script

Getting iTunes to script
Thread Tools
Grizzled Veteran
Join Date: Sep 2000
Location: .au
Status: Offline
Reply With Quote
Feb 26, 2003, 12:35 AM
 
Hey,

I'm pretty new to AppleScripting, but I was trying to make iTunes script. However... it doesn't seem to want to.

tell application "iTunes"
activate
play
end tell

From what I can gather, that should open iTunes and get it to start playing.

Instead, I get an error: "the variable play is not defined".

This link says that play is the variable to start playing songs.

Any help would be much appreciated

-- james
     
Dedicated MacNNer
Join Date: Nov 2000
Location: Malaysia
Status: Offline
Reply With Quote
Feb 26, 2003, 07:23 AM
 
This is the thing I *HATE HATE HATE* about applescript...how do you know what commands work for what application?!!

Unfortunately, the link you gave was for a PERL script ("control iTunes from Perl"...via applescript). "play" is a valid method in this perl module that then calls the appropriate iTunes applescript command.

The only way I know anything about the command is because I downloaded the iTunes Script Collection from http://www.apple.com/applescript/itunes

Looking at the script entitled "Play Random Track", you can see that you have "track" variable/object somehow, and then use the "play" command followed by the variable:

tell playlist library
set this_track to first track
play this_track

(I hope this helps). But there *MUST* be some way of saying "play current track from current playlist" or "pause/resume current track". How do you get these commands for an individual application?

---gralem
     
Professional Poster
Join Date: Oct 2001
Location: London
Status: Offline
Reply With Quote
Feb 26, 2003, 07:44 AM
 
perhaps because there is no event called play in the iTunes Dictionary.

You are looking for PlayPause.

To see what commands you can issue to an app look at its AppleScript Dictionary in Script Editor. (file menu - Open Dictionary.)
     
Mac Elite
Join Date: Jul 2002
Location: Right Here
Status: Offline
Reply With Quote
Feb 27, 2003, 02:15 PM
 
Originally posted by jamesa:
.

tell application "iTunes"
activate
play
end tell

Strangely, that script works fine on my computer. Are you using Script Editor? What version?
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:50 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2