Find, List, Convert & Erase files

  1. I want to tell application "Finder"to locate all files with the extension “.aif”

  2. create a new folder named AIF

  3. move all files with extension “.aif” to folder named AIF

  4. import the “.aif” files into iTunes and convert to mp3 files

  5. erase all “.aif” files

I’ve noticed in this forum that there is a command called: extensionList does this take the place of deal_with_file command?

On an entire hard drive or in a particular location?

I think most of these steps are doable - I’m not up to speed on the capabilities of iTunes.

I suspect that extensionList is a variable but it depends on where it appears in a script - it could be terminology from an application or scripting addition. A variable is a place to store information in a script and there are various naming conventions in use by scripters.

This would be on all drives (global)

Wow. Well, I’d recommend using the UNIX ‘find’ utility, which can do the find a move for you quickly. A VERY similar example is used on that uses that command to find all PDF files not in a desired folder, then puts them there. You could call something like that using do shell script.

The rest of the steps are al possible, too.

Can you tell me how ?

Also see my reply on an other posting :

Actually, I find both threads confusing/ Are you just trying to quickly get some files converted from AIFF to MPEG-4 audio? If so, you can literally drag the files into iTunes’ window. It adds them to its library. Then you can highlight them and choose convert to AAC from the Advanced menu (I think). If it says “convert to MP3” you can change it to AAC in the Preferences. Then you can remove the AIFF files from your library. If that doesn’t work, then automating it won’t help, because it would mean there is something wrong with your installation of iTunes. If it does, then you’d want a script that mimics this. Can you verify that the manual method works, and that you then want to automate it?

Sorry 'bout that. Should have made myself more clear. This is the whole story:

I’ve made a script that records a 3 hour radioshow every day at a certain time triggered by iCal. (streamed by windows media player and recorded by WireTap). When the recording is done the file (AIFF) is renamed in the finder with today’s date in the name. After renaming I would like it to automatically import into iTunes, be converted to MP3 (or AAC) and if necessary change its ID3 Tags. All in the same script.

The idea is to have this setup work unattended 5 (week)days a week so I can pop my iPod in its dock every week and have it sync the new recordings in a few seconds.

BTW: I know WireTap can automatically open a finished recording in an app (like iTunes) but when i configure it like that I can’t find a way to handle/select/edit the imported file in iTunes (to change its name, convert it, etc.) → in a way the same problem as above …

any help or example script would be great.



Hmm. Well, if WireTap can make it open in iTunes, you can then get the current track in iTunes. Even better, tell iTunes to set the selection to the current track, then convert the selected track. Does that make sense? I’m trying to work around the problem that it seems impossible to refer to an iTunes track by its unique “database ID.” You can find out what a track’s ID is, but you cannot say, for example:

tell app ""iTunes"
	set comments of (track whose database ID is 10950) to "TEST"
end tell

It seems that iTunes does not support the whose clause in this case, which is disappointing. Anyone know a workaround for this?

Thanks for the effort.

Jonn8 got me a solution that works almost “out of the box”.

check out the other thread: