RSS Feedings
What's New...
30 Most Recent
dougscrptr
Site Menu
[ Home
[ What's New
[ 440 Scripts...
- ...by category:
- Managing Tracks
- Managing Track Info
- Managing Artwork
- Managing Playlists
- Controlling iTunes
- Exporting Info
- Managing Files
- Networking
- Internet
- iPod
- Miscellaneous
- With Other Apps
- Retro Scripts
- Script Stats
[ Download FAQ...
[ Missing Menu Commands
[ FAQ & Solutions
[ Tips & Info
[ Forum at iLounge
[ dougscrptr
[ Twitter
[ my del.icio.us
[ Uhm, Windows?
Shareware Apps
- Dupin v1.3.3
- Join Together v5.2.1
- iTunes Library Manager v5.1
Site Info
- Who's Doug?
Folder Actions and iTunes
Set up a Folder Action in OS X to automatically add files to iTunes when they are added to a particular folder.
I would have sworn that in earlier versions of the OS this was not possible. I wanted to automatically add files to iTunes when they arrived in a downloads folder. But after reading up on Folder Actions at Apple's site, I came up with the script below.
Folder Actions are AppleScripts that you "attach" to a folder in the Finder. When particular actions occur, such as opening the folder, resizing the folder, adding or removing files, the attached AppleScripts are activated and perform their tasks in the background.
This particular script will attempt to add any files to iTunes that have been added to a folder to which it is attached. You first compile and save the script with Script Editor. Name it "add files to iTunes" and save it to Library > Scripts > Folder Actions.
Create a folder to which you will be adding audio files. For discussion, let's call it "New Music" and place it in your "home" folder. Open "New Music" and Control-Click inside its window. From the pop-up click on "Enable Folder Actions" (if you see "Disable Folder Actions", then you are all set). Next, Control-Click again to "Attach a Folder Action...". This will bring up a dialog so you can locate the "add files to iTunes" and select it.
Now, whenever you add a file to "New Music", it will be added to iTunes. Only audio files can be added to iTunes, so don't worry if you drop a Word file or something else in there.
If you want more information on Folder Actions, be sure to read about them at Apple!
One more thing: if you have your iTunes Preferences set to "Copy files to iTunes Music folder when adding to library" checked, you may want to delete the original file in "New Music" after it is added to iTunes. In that case, remove the block comment tags from the script—the "(*" and "*)"—so that the UNIX shell script commands can be active. These commands will remove the audio file from "New Music"
on adding folder items to my_folder after receiving the_files repeat with i from 1 to number of items in the_files tell application "iTunes" launch try set this_file to (item i of the_files) add this_file (* -- if you have iTunes set to --"Copy files to iTunes Music folder when adding to library" -- then you might want to delete the original file... -- if so, remove comments from this block and -- use the UNIX commands below to delete the file set the file_path to the quoted form of the POSIX path of this_file do shell script ("rm -f " & file_path) *) end try end tell end repeat end adding folder items to click to open in Script Editor (what's this?)