How to script “add to iTunes Library”

applescriptdmgituneszip

I'm trying to deliver as a download a collection of audio files such that the user (preferably Win and Mac) would be able to double click on the file (perhaps a DMG? / ZIP) and launch a script that would then add the media to the users iTunes library.

I realize that's big on concept and thin on detail — At the moment I see it as a number of different problems.

  1. How to create a DMG file
  2. how launch a script for the user to do the add to library when the open the DMG (or zip on Win)
  3. how to actually do the scripting (again obviously different for Mac than Win)

I'm not expecting anybody to do the work for me, but I would appreciate pointers to suitable resources.

Best Answer

On the Mac side, you can create a DMG file with Disk Utility. Once started you can either select "New Image" to create a an empty one or use N to create an image based on a folder.

To copy the audio files to iTunes, it's probably easiest to just move/copy them to ~/Music/iTunes/iTunes Media/Automatically Add to iTunes (may be called differently, just look at the folder first) and let iTunes (which must be running) do the rest.