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 > AppleScript: whose something is in something?

AppleScript: whose something is in something?
Thread Tools
Mac Elite
Join Date: Sep 2000
Location: Eagan, MN
Status: Offline
Reply With Quote
Jan 16, 2002, 11:01 AM
 
I'm trying to do the following (with iTunes):

set sub_tracks to tracks where album is in {"Album 1", "Album 2"}

but AppleScript turns it into

set sub_tracks to tracks where {"Album 1", "Album 2"} contains album

which is apparently illegal.

Anything I can do?
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Jan 16, 2002, 11:39 PM
 
Originally posted by mr_sonicblue:
<STRONG>I'm trying to do the following (with iTunes):

set sub_tracks to tracks where album is in {"Album 1", "Album 2"}

but AppleScript turns it into

set sub_tracks to tracks where {"Album 1", "Album 2"} contains album

which is apparently illegal.

Anything I can do?</STRONG>
...in your title you said "whose" but in your text you said "where"? Anyways, it seems that scripting with iTunes is seriously flawed. i.e. "is in" doesn't seem to work. Also you need to define which playlist the track is from. This is messy but should work:

tell application "iTunes"
tell playlist 1
(every track whose album is "Album 1") & (every track whose album is "Album 2")
end tell
end tell


Album is a property of track, so you have to get the property of the class. Not "where" it is.
property of every class whose property is/contains/starts with ""/{}
     
Mac Elite
Join Date: Sep 2000
Location: Eagan, MN
Status: Offline
Reply With Quote
Jan 17, 2002, 10:38 AM
 
Thanks for the response.

According to the documentation, 'where' is an alias for 'whose'.

And I was using this to get to the main playlist (but didn't paste it into my post):

tell application "iTunes"
tell source "library"
tell playlist "library"
-- stuff here
end tell
end tell
end tell

Thanks again
     
   
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 09:44 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