Re: How do you add a track not currently in iTunes to iTunes playlist using applescript
Re: How do you add a track not currently in iTunes to iTunes playlist using applescript
- Subject: Re: How do you add a track not currently in iTunes to iTunes playlist using applescript
- From: has <email@hidden>
- Date: Tue, 8 Jan 2008 21:16:43 +0000
On 8 Jan 2008, at 20:34, Paul Taylor wrote:
has wrote:
Here is the corrected version of your code:
tell application "iTunes"
set new_playlist to (make user playlist with properties
{name:"New Playlist"})
add (POSIX file "/Users/has/Music/WoTW/wowa.mp3") to
new_playlist
end tell
Thanks very much, one more question the references I have are the
AppleScript Language Guide , the iTunes Dictionary accessed via the
Script Editor and Doug Scripts website. None of these specify the
POSIX file thing so Im wondering is this just basic Applescript
knowledge or is there a more detailed iTune reference that I should
be looking at.
The 'POSIX file' specifier has been around for a while now (OS 9? OS
10.1?), but the AppleScript Language Guide hasn't been updated since
OS 8. (Apple are currently working on this.)
Well designed scriptable applications should use either 'alias'
objects to refer to existing filesystem objects, or 'POSIX file'
objects to refer to filesystem locations that may or may not exist.
For historical reasons, 'alias' specifiers require an OS 9-style HFS
path string (e.g. "disk:folder:file"). 'POSIX file' specifiers
require a POSIX path string (e.g. "/Volumes/disk/folder/file"). Since
your code was already using a POSIX path string, it made sense to use
a 'POSIX path' specifier to convert it to a 'POSIX file' object, which
the 'add' command will then accept [1].
If you search the list archives you should fine plenty of past
discussion of 'alias' and 'POSIX file' objects.
HTH
has
[1] According to iTunes' dictionary, its 'add' command actually
requires a list of alias objects. However, iTunes is smart enough that
if you pass it a POSIX file object, it will automatically coerce it to
the right type for you.
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden