Re: HELP Remove Missing Tracks from iTunes Library
Re: HELP Remove Missing Tracks from iTunes Library
- Subject: Re: HELP Remove Missing Tracks from iTunes Library
- From: Simon Brown <email@hidden>
- Date: Fri, 07 Feb 2003 13:31:19 +0000
Pete Dako <email@hidden> wrote
>
Subject: HELP Remove Missing Tracks from iTunes Library
>
>
It's an Apple supplied iTunes script from their website but it won't
>
run on my machine.
>
The "Remove Missing Tracks" is supposed to remove song references in
>
the iTunes Library for all songs that have been removed from your
>
drives. Can someone tell me if it will run for them or why it's not
>
running for me?
>
>
When I run it I get the following Apple Script Error:
>
>
"No result was returned from some part of this expression"
>
>
with "missing value" highlighted in the repeat /if then section below...
>
>
thanks in advance...
>
>
--------------------------------------
>
>
display dialog "This script will remove every track, whose
>
cooresponding file is missing, from the Library." & return & return &
>
,
>
"This action cannot be undone." buttons {"Remove
>
Tracks", "Cancel"} default button 2 with icon 2
>
>
display dialog "Beginning process." & return & return & ,
>
"One moment
>
" buttons {"*"} default button 1 giving up after 1
>
>
set the stored_setting to fixed indexing
>
set fixed indexing to true
>
tell source "Library"
>
tell playlist "Library"
>
-- delete (every track whose location is missing value)
>
set the counter to 0
>
repeat with i from the (count of tracks) to 1 by -1
>
if the location of track i is missing
>
value then
>
delete track i
>
set the counter to the counter + 1
>
end if
>
end repeat
>
end tell
>
end tell
>
set fixed indexing to the stored_setting
>
>
display dialog "Process complete." & return & return & ,
>
(counter as string) & " tracks were deleted." buttons
>
{"OK"} default button 1
>
end tell
>
_______________________________________________
Here's one that works for me, though it's probably not very well
constructed. I have to select the tracks in the library first:
tell application "iTunes"
set deletedItems to {}
set sellitems to location of the selection
set itemCount to the count of sellitems
log (itemCount as string) & " items Selected"
repeat with x from itemCount to 1 by -1
--log "Item " & x & " " & item x of sellitems as string
if item x of sellitems is missing value then
set the end of deletedItems to the name of item x of the
selection
log item (count of deletedItems) of deletedItems
delete item x of the selection
end if
end repeat
end tell
set iDeleted to the count of deletedItems
display dialog (iDeleted as string) & " of " & (itemCount as string) & "
Items deleted." buttons {"OK"} default button 1 with icon 1
return deletedItems
Like I say, works for me, but you'll have to suck it and see or wait for one
of the gurus to respond.
Best regards
Simon Brown
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.