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

Similar Threads
thread Thread Starter Forum Replies Last Post
Can you write a script to auto delete text messages? bobfitz14 iOS 7 6 Mar 23, 2014 04:26 PM
Auto-login Multiple users who then launch a script RobQuads Mac OS X Server, Xserve, and Networking 6 Oct 9, 2013 07:11 PM
Script to Auto Record incoming Skype calls with Piezo Shawzborne Mac Programming 1 Aug 13, 2013 04:05 PM
Launchd and auto-enroll certificate script not working blabla296 Mac Programming 1 Jul 29, 2013 01:28 AM
Script to auto quit hung app UFGrayMatter Mac Basics and Help 6 Nov 3, 2012 12:09 PM

Forum Jump

All times are GMT -5. The time now is 11:34 PM.

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

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