When I have the track name in quotes it successfully adds the track to the playlist "talks". See example:
tell application "iTunes"
duplicate track "Big Ruby Conf 2013 Keynote by Jim Weirich-vIHdhaF2R2w.mp3" to playlist "talks"
end tell
But what I want to do is pass in a command line argument for the track that I want to add to my playlist, like so:
on run argv
tell application "iTunes"
duplicate track argv to playlist "talks"
end tell
end run
When I do that I get this error:
osascript add_track_to_talks.scpt "Big Ruby Conf 2013 Keynote by Jim Weirich-vIHdhaF2R2w.mp3"
add_track_to_talks.scpt: execution error: iTunes got an error: A descriptor type mismatch occurred. (-10001)
I know passing command line arguments works because I wrote something simple to test it:
on run arg
log "hello: " & arg
end run
When I run it with this command:
osascript log_test.scpt "Blake"
I get this output:
hello: Blake
Any ideas on the correct way to pass in a track name as a command line argument?