PDA

View Full Version : why doesn't properties of current track work?


PCheese
09-07-2004, 11:59 AM
If you run properties of me in script Editor, you'll get something like this:

{selection:insertion point before character 1 of text of document ??
"Untitled", name:"Script Editor", frontmost:true, version:"2.0", ??
class:application}.

But if I run

tell app "iTunes" to get properties of current track

it gives me "iTunes got an error: A descriptor type mismatch occurred."

I can get properties of just about anything, such as Finder files and windows, but for some reason iTunes won't give them to me...

Does anyone know how I can get all the properties of a given track without using lots of assignment statements? The best I could come up with was something like:

tell application "iTunes" to set {theName, theArtist, theAlbum} to ??
{name, artist, album} of current track

Doug Adams
09-07-2004, 01:04 PM
Ahhh! AppleScript is a mysterious mistress!

The current track class isn't set up to give you properties like that. You have to get them the way you have illustrated.

tell application "iTunes"
if player state is not stopped then
tell current track
set {nom, alb, art, siz} to {name, album, artist, size}
end tell
end if
end tell
There is only a current track when iTunes is playing or paused, thus the player state if-then.