Re: Adding files to iTune library in Cocoa app
Re: Adding files to iTune library in Cocoa app
- Subject: Re: Adding files to iTune library in Cocoa app
- From: John Stiles <email@hidden>
- Date: Mon, 25 Jun 2007 14:52:53 -0700
On Jun 25, 2007, at 12:26 PM, Gregory Weston wrote:
Angelo Chen wrote:
Is there a way to add files into iTune library in a
Cocoa app? Thanks
tell application "iTunes" to add (POSIX file "thePath") to (first
library playlist)
Wrap that in an NSAppleScript, with thePath replaced by the full
path of the track you want to add.
Be careful—this will not work if the path contains any non-MacRoman
characters. (Which means that in many countries it will never work.)
The fix involves replacing "thePath" with a goofy hack/workaround
that looks like this:
(«data utf84142434445464748» as Unicode text)
You plug in hexadecimal numbers corresponding to the path string, in
UTF8, after the 'utf8' bit.
I wish there were a simpler way…_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden