views:

75

answers:

0

I need to get a reference to track object from music library by using track's path. I know the path in advance and I'd like to be able to get the track without iterating through the entire library. I'm trying the following code and getting "Descriptor type mismatch" error.

tell application "iTunes"
    set musicLib to (get some playlist whose special kind is Music)
    set trackLocation to alias "Macintosh HD:Users:bla-bla:track.mp3"
    set theTrack to (get some track of musicLib whose location is trackLocation)
end tell

I've also tried this

set trackPath to "/Users/bla-bla/track.mp3"
set theTrack to (get some track of musicLib whose POSIX path of location is trackPath)

This didn't work either. I'm very new to AppleScript, so I guess I don't understand something. I'd be greatly appreciated for any help on this. Thanks in advance.