If you are OK with temporarily having the converted tracks in your iTunes library, you could use AppleScript to convert the track, remove the reference to the converted track, and finally move the converted file where ever you like.
Plain AppleScript has little capability for smooth UI, but the following script might do what you want. Paste it into Script Editor (or AppleScript Editor on Snowy) and save it as an “application bundle” (“application” on Snowy). To use it, configured your conversion settings (Import Settings) in iTunes, select some tracks in iTunes, then drop a folder on the saved application. Note that newly converted files will overwrite pre-existing files in the dropped folder (if their names are identical). It is probably best to drop empty folders unless you are sure you want any overwrites you might get. You might even get some ID3v2 tags out of the process (I did in some testing, but it depends on what iTunes decides to do).
on run
display dialog "Drop a folder on this application to convert iTune's selected tracks and place them the dropped folder." & return & return & "The converted files will be whatever is selected in iTunes “Import Settings”." with title "About"
return
-- Test invocation:
"/tmp/convert_to_external"
alias POSIX file result
open {result}
end run
on open theItems
if length of theItems is 0 then
display dialog "No items dropped? Only a single, plain folder should be dropped." with title "Error: Drop Only a Single Folder"
return
end if
if length of theItems is greater than 1 then
display dialog "Too many items have been dropped. Only a single, plain folder should be dropped." with title "Error: Drop Only a Single Folder"
return
end if
set theItem to first item of theItems
set info to info for theItem
if not folder of info or package folder of info then
display dialog "“" & POSIX path of theItem & "” is not a plain folder. Only a single, plain folder should be dropped." with title "Error: Drop Only a Single Folder"
return
else
|convert iTunes selection into folder|(theItem)
end if
end open
to |convert iTunes selection into folder|(folderRef)
try
do shell script "test -d " & quoted form of POSIX path of folderRef
on error m
display dialog "Destination (" & destinationForShell & ") not accessible?" & return & m
return
end try
tell application "iTunes"
set trackList to selection
repeat with selectedTrack in trackList
try
set convertedTrack to my convertTrack(selectedTrack)
set convertedFile to location of convertedTrack
my deleteTrackReference(convertedTrack) -- only delete the iTunes ref, not the track's file
my moveItemToFolder(convertedFile, folderRef)
on error m
tell me to display dialog m with title "Error During Conversion/Removal/Move" -- giving up after 30
end try
end repeat
end tell
end |convert iTunes selection into folder|
to convertTrack(aTrack)
if class of aTrack is list then error "Must pass a single track."
using terms from application "iTunes"
set questionTimeout to 10
set conversionTimeout to 600
display dialog "About to start conversion of “" & name of aTrack & "”. Select a timeout in seconds for the conversion (conversion will auto-start in " & questionTimeout & " seconds):" default answer conversionTimeout with title "Conversion Time Limit" giving up after questionTimeout
try
set conversionTimeout to (text returned of result) as number
end try
set convertedTrack to missing value
with timeout of conversionTimeout seconds -- conversion may take longer than the deafult 120 second AppleEvent RPC timeout
try
set convertedTrack to convert aTrack
on error
error "Error while converting track."
end try
end timeout
if convertedTrack is not missing value then return first item of convertedTrack
error "Abandoning track conversion after timeout." & return & m
end using terms from
end convertTrack
to deleteTrackReference(aTrack)
try
tell application "iTunes" to set mainLibrary to ¬
first library playlist of (first source whose kind is library)
on error
error "Unable to find main library playlist object."
end try
using terms from application "iTunes"
try
set convertedTrackInMainLibrary to ¬
(first track of mainLibrary whose database ID is (get database ID of aTrack))
on error
error "Unable to find track object in main library playlist."
end try
try
delete convertedTrackInMainLibrary -- deletes the reference, not the actual file
on error
error "Unable to delete track from main library playlist."
end try
end using terms from
end deleteTrackReference
to moveItemToFolder(itemRef, folderRef)
set itemPath to POSIX path of itemRef
set folderPath to POSIX path of folderRef
try
do shell script "mv " & quoted form of itemPath & " " & quoted form of folderPath
on error m
error "Unable to move item (" & itemPath & ") to destination (" & folderPath & "):" & return & m
end try
end moveItemToFolder
I've never noticed it do that - is it new with 9? – warren – 2009-09-28T10:07:55.930
3@warren: No, that isn't new – Tim Büthe – 2009-09-28T14:34:35.020