Set Default Encoder in iTunes (Applescript)

I dug up this command today for a project, with the help of Doug’s Applescripts for iTunes.


tell application "iTunes"
set current encoder to encoder "MP3 Encoder"
end tell

We like to set the default encoder for importing, especially on shared computers, in order to facilitate the conversion of audio files captured using Olympus audio recorders and Windows computers.

I also learned how to show all of the supported Applescript commands for an application: Script Editor -> File menu -> Open Dictionary. Now why didn’t I know that two months ago?

Unfortunately, iTunes does not include support to show the Kind column in the items view, which I was hoping to script.

3 comments

  1. Michael Steinberg says:

    Yeah, Rich, AppleScript rules! Nice tip. This means that .wav or other audio files dropped into (imported into) iTunes will be converted to mp3? I’ve been using Switch to batch convert from our Olympus recorders:

    http://www.nch.com.au/switch/

    Can you be more specific how/when you use the script? Do you just copy it to shared machines and have students run it before importing?

    BTW, did my follow-up laptop question make it to you?

  2. Martin Michel says:

    Hi Richard,

    You can also drag application icons onto Script Editor’s icon (in the Dock) to instantly inspect their AppleScript dictionary (if available).

    Moreover you could try to script iTunes to show the Kind column in the items view with GUI Scripting:

    http://www.apple.com/apples

    If you need any help, then I invite you to visit the AppleScript Forums over at MacScripter.net:

    http://bbs.macscripter.net/

    Happy Scripting!

  3. Richard says:

    Michael: Not exactly. iTunes can read WAV files and will import them as is. However, you can select WAV files and then select Advanced menu -> Convert Selection to MP3.

    We perform an annual maintenance process on all student and faculty laptops. We recently added this to the list of steps to complete, so that users have MP3 as their default, making podcasting one step easier.

    Martin: Yes, thanks for these links. I read an article that suggested that GUI scripting this particular feature is very difficult because the option is buried within the View Options window, and GUI scripting cannot tell whether a checkbox is on or off.