Re: Delete Bug or Feature?
Re: Delete Bug or Feature?
- Subject: Re: Delete Bug or Feature?
- From: Doug Adams <email@hidden>
- Date: Tue, 12 Feb 2008 12:32:50 -0500
On Feb 12, 2008, at 12:07 PM, KOENIG Yvan wrote:
Le 12 févr. 2008 à 17:40, Doug Adams a écrit :
On Feb 12, 2008, at 11:07 AM, Mark J. Reed wrote:
On Feb 12, 2008 10:22 AM, Doug Adams <email@hidden> wrote:
As of iTunes 7.6, using delete to remove a track from library
playlist 1 will also move the
tracks file to the Trash.
Is there perhaps an optional clause to the delete command that will
prevent it from doing that?
There are no optional parameters for delete. From iTunes' aete:
delete v : Delete an element from an object
delete specifier : the element to delete
There is no suggestion that a file can/shall/will be moved to the
Trash, only that an element (a track or playlist) will be deleted
from an object (a playlist or source).
I've always thought that "remove" would be a better command name in
this situation than "delete". It is too similar to the Finder's
delete command, which *does* move a file/alias to the Trash.
By the way, I have tested this with iTunes v7.5 and the delete
command works as expected. So it appears to be an issue with iTunes
v7.6.
Doug
Hello
I don't understand where is the problem.
As far as I know, the Finder is the sole Apple application which is
allowed to dete a file with the meaning "move it to the trash".
All of us are supposed be aware that, Aren't we ?
Yvan KOENIG
The problem is this:
Until iTunes 7.6, the traditional way to remove a track from an iTunes
playlist was to use something like this:
tell application "iTunes"
tell playlist "Mom's Favorites"
delete some-track-reference
end
end
This would remove the track from the playlist, but keep it in the
library ("Music", "Movies", or whatever) , emulating using the Delete
key on a track in a playlist.
To remove a track entirely from iTunes, that is from all playlists
*and* the library:
tell application "iTunes"
tell library playlist 1
delete some-track-reference
end
end
This would NOT delete the track's file. It never did. It just removed
the track from iTunes' database. (As I have mentioned, "delete" in
this case is a misnomer.) There are cases where you wouldn't want to
delete the track's file, say a workflow that used iTunes to alter some
tags, then remove the track from iTunes and then use the file in some
other app.
However, if you *wanted* to also delete the track's file, you would
have to do a separate delete routine:
-- first remove the track...
tell application "iTunes"
tell library playlist 1
set the_loc to (get location of some-track-reference) -- gets alias
to track's file
delete some-track-reference
end
end
-- now, Trash the file
tell application "Finder"
delete the_loc -- moves to Trash
end
-- or use a UNIX command to completely delete the file
do shell script "rm " & quoted form of POSIX path of (the_loc as string)
The issue with iTunes 7.6 is that there is no way to *prevent* the
track's file from going to the Trash when using delete to remove the
track from the library. (Removing a track from a playlist with delete
works as expected.) A cumbersome workaround would be to copy the file
from the Trash to wherever you need it to be, but, to my mind, that
would be plain *wrong*.
Doug
--
Doug's AppleScripts for iTunes
http://dougscripts.com/itunes/
_______________________________________________
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