Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   OS X - Development and Darwin (http://www.mac-forums.com/forums/os-x-development-darwin/)
-   -   Help Please! I need Applescript help! (http://www.mac-forums.com/forums/os-x-development-darwin/258467-help-please-i-need-applescript-help.html)

jf4m 11-25-2011 04:11 PM

Help Please! I need Applescript help!
 
Hi everyone, I'm a new poster to the forum but have always searched through your vast knowledge for other issues :)

I have an unusual setup at home, we have a XServe running 10.5.8 that has hard drive specifically for storing movies and TV shows. With the addition of an AppleTV to our living room, we decided that we would like all of the movies and TV shows added to iTunes. After a ton of converting and adding meta data, I finally have all the files we currently have in iTunes. The problem is, tomorrow when I rip yet another princess DVD for our daughter and add it to the movies folder, how do I get it to be added to iTunes automatically so she can access it through the AppleTV?

I found on DougScripts page the simple applescript for adding to iTunes, but it isn't working for me. I think because of the way we have our folder structure:

Movies
>Action
>>Title 1
>>Title 2
>Family
>>Title 1
>>Title 2
ect....

The script is:
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

end try
end tell
end repeat
end adding folder items to

Please Help! I have worked on it and searched for hours and am at my wits end. :(

Mark FX 11-26-2011 02:59 PM

That can't be the whole Applescript that you have posted.
It looks like just a single Applescript method that you have there, and it has no way of
knowing what folder the my_folder variable needs, or the files the the_files variable also needs.

Post the whole script if you need help with it, or a link to the downloaded Applescript so
someone can go through the linked script.

Regards Mark

MacGrunt 12-02-2011 08:34 AM

This IS a complete applescript. The structure — "on adding folder items..." — indicates it is set up to be run as a folder action. The script needs to be attached to a folder — when items are dropped in the folder, the script will add them to iTunes.

But, jf4m, that's the extent of the script — it just adds the items to iTunes. This script in its current form has no way of knowing which part of the hierarchy you are trying to add an item to. So, basically, it does exactly the same as drag-dropping the files straight onto the iTunes icon in your dock (except it won't automatically start playing them).

I expect the script was originally written to work with a download folder (ie. items are added to iTunes at download — without the need to drag-drop)

Hope that helps a little.

m.


All times are GMT -4. The time now is 12:41 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.