Script to "Add to Library"?

GO TO ADMIN PANEL > ADD-ONS AND INSTALL VERTIFORO SIDEBAR TO SEE FORUMS AND SIDEBAR

jbond

New member
Joined
Jul 2, 2003
Messages
1
Points
0
Hello,

Is there a simple way to script iTunes to perform an "Add to Library" command on my Music folder? Just as if I clicked "File -> Add To Library -> Choose" (where the Music folder is the default selection)?

What I am trying to accomplish is this: I am using the Unix command 'brag' to download mp3 files from a Usenet group every morning. I have a cron job running which downloads the files then moves them into my Music folder. The final step, which I have to do manually, is to open iTunes and select "File -> Add To Library -> Choose", then let iTunes do its stuff and add all the new files to the library.

It would be way cool if I could automate that last step.

Thanks for any suggestions,

-Jeremy
 

eustacescrubb

New member
Joined
Jan 18, 2002
Messages
2,284
Points
0
Age
45
Website
www.johnpauldavis.org
Yes, you can do this.

The "add" command is actually just "add', like so:

tell application "iTunes"
add alias or list of alias to library playlist 1
end tell
You can actually run AppleScripts from the Terminal, and you can create AppleScripts and run them from the command line as well - see here for a brief description of both methods.

And, you can run shell scripts from AppleScript, using the do shell script command.
I'm thinking you'll need to create an AppleScript that looks in the folder where your downloads are stored, generates a list of aliases for the downloads, and then adds those to iTunes, and run this script as the last item in your cron jobs.
 

deeg

New member
Joined
Jul 1, 2003
Messages
394
Points
0
Location
Swampland, UK
another method would be to use an action script on the download folder, which moves them over to your music folder and
add's them to itunes when ever it detects a new file being added to the download folder.. might need to add some file type checking if you only have one general download folder for everything you download.. see http://www.apple.com/applescript/folder_actions/ for examples of action scripts...
 
Top