Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Mar 27, 2009, 06:22 AM   #1
alptkz
macrumors newbie
 
Join Date: Feb 2009
[Apple Script] auto label unplayed movies

hi all.

I'm trying to write a script (very little experience here) for a folder action that will label in blue all the video files in my Movies folder that have never been played.

I find myself way over my head on this. Can anyone help me out ?
alptkz is offline   0 Reply With Quote
Old Mar 27, 2009, 10:26 AM   #2
LtRammstein
macrumors 6502a
 
Join Date: Jun 2006
Location: Denver, CO
Send a message via AIM to LtRammstein Send a message via MSN to LtRammstein
Have you looked into the AppleScript iTunes library? I belive there's an element in there that would allow you to do it, but not sure (on a PC in a lab right now).

You might need to also teach yourself AppleScript before you go any further. I recommend you search Google for any tutorials that might help out.
__________________
17" White Intel iMac 1.83GHz, 250 GB HD, 2 GB RAM || iPod Touch 16GB w/ 3.0 || 15" Intel MBP 2.4GHz, 250 GB HD, 4 GB RAM
LtRammstein is offline   0 Reply With Quote
Old Mar 27, 2009, 11:24 AM   #3
alptkz
Thread Starter
macrumors newbie
 
Join Date: Feb 2009
I looked in the iTunes dictionary, but I'm not really sure what to look for. In fact, why is iTunes involved at all ?

The way I picture it, the script would check in a folder if the video files (all avi actually) have been played or not, and if not, assign a blue label, if yes then no label.

The question is, is there a way to check whether the file was played (or opened) or not. If not, I'm guessing I'd need to do it in 2 scripts. One that watches for added files and labels them as soon as they are added. The 2nd would remove the label as soon as the file is played.

Am I looking at this wrong ?
alptkz is offline   0 Reply With Quote
Old Mar 27, 2009, 12:39 PM   #4
alptkz
Thread Starter
macrumors newbie
 
Join Date: Feb 2009
Ok I've gone for option 2 as it seems more straight forward. I've created succesfully one script that labels any video file added to my Movies folder. It looks like this:
Quote:
on adding folder items to this_folder after receiving these_items
tell application "Finder"

repeat with myFile in these_items
--display dialog myFile as string
if the name extension of myFile is in {"mpg", "mpeg", "avi", "mov", "mp4", "avi", "wmv"} then
set label index of myFile to 4
end if

end repeat
end tell
end adding folder items to
That works great, but it doesn't include subfolders. How can I do that?

Then I created a 2nd script that would remove the label when a video file is opened. It doesn't work though. This is what I wrote so far:
Quote:
on open these_items
tell application "Finder"

if the name extension of these_items is in {"mpg", "mpeg", "avi", "mov", "mp4", "avi", "wmv"} then
set label index of these_items to 0
end if

end tell
end open
I'm guessing my problem is on the first blue line, I just don't know what to use there.

Any ideas ?
alptkz is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
UPDATED: AppleScript Question, iTunes Auto Labeler... brayhite Mac Applications and Mac App Store 2 Jul 1, 2010 01:35 PM
Apple Script Auto Login rgoth Mac Programming 0 Nov 9, 2009 12:13 PM
iPod Auto Sync Apple Script Help vladimir929 Mac Programming 4 Dec 21, 2008 02:40 PM
Why doesn't Apple offer auto movie trailer downloads into video iPod? irock iPod 15 Jan 3, 2006 03:04 AM


All times are GMT -5. The time now is 07:09 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC