Diese AppleScript action importiert die input Dateien in iTunes, …

konvertiert MP3 zu AAC (wenn notwendig) und löscht die MP3 Dateien in iTunes (in der Bibliothek und im Finder).

Es löscht aber nicht die input Dateien.

Falls ein Fehler beim Konvertieren auftritt, wird ein Dialog angezeigt und die importierte MP3 Datei nicht gelöscht.

Show Plain Text
  1. on run {input, parameters}
  2.   with timeout of 3600 seconds
  3.     tell application "iTunes"
  4.       set importedTracks to add input
  5.       set currentEncoder to current encoder
  6.       set current encoder to encoder "AAC encoder"
  7.       set tracksToDelete to {}
  8.       repeat with aTrack in (get importedTracks)
  9.         if kind of aTrack is not "AAC Audio file" then
  10.           try
  11.             set aacTrack to convert aTrack
  12.             set end of tracksToDelete to contents of aTrack
  13.           on error e
  14.             display dialog "error: " & e
  15.           end try
  16.         end if
  17.       end repeat
  18.     end tell
  19.     repeat with aTrack in tracksToDelete
  20.       tell application "iTunes"
  21.         set filePath to location of aTrack
  22.         delete aTrack
  23.       end tell
  24.       tell application "Finder" to delete filePath
  25.     end repeat
  26.     tell application "iTunes" to set current encoder to currentEncoder
  27.   end timeout
  28.   return input
  29. end run
----------
Gruss

Stefan