New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

AppleScript Help Needed: Delete Watched TV Shows in iTunes


Post Reply New Thread Subscribe

 
Thread Tools
AustinMatherne

 
AustinMatherne's Avatar
 
Member Since: Feb 16, 2010
Location: Stamford, Connecticut, USA
Posts: 2
AustinMatherne is on a distinguished road
Mac Specs: Apple MacBook Pro 17"

AustinMatherne is offline
First off, I'm extremely new to AppleScripting, I've only read a few beginners guides and I'm just starting to understand how it all works. But you gotta start somewhere right?

What I'm trying to create is an AppleScript that will delete any watched TV Show from both the iTunes database and the physical video files. I figure that if I create a smart playlist in iTunes that pulls in every TV Show with a play count greater than 0 it should make deleting the shows a bit easer.

If anyone knows how to do this and could point me in the right direction, I would truly appreciate it.

Thanks,

~ Austin
QUOTE Thanks
AustinMatherne

 
AustinMatherne's Avatar
 
Member Since: Feb 16, 2010
Location: Stamford, Connecticut, USA
Posts: 2
AustinMatherne is on a distinguished road
Mac Specs: Apple MacBook Pro 17"

AustinMatherne is offline
I've got the script below which seems to work perfectly, but I'm stuck on adding an error check so that if it doesn't find anything to delete it won't display an error. If anyone knows how to do this, I'd truly appreciate the help.

Code:
tell application "iTunes"
 	set filesToDelete to location of (file tracks whose (video kind is TV show) and (unplayed is false))
 	delete (tracks whose (video kind is TV show) and (unplayed is false))
 end tell
 tell application "Finder"
 	repeat with theFile in filesToDelete
 		delete theFile
 	end repeat
 end tell
Thanks,

~ Austin
QUOTE Thanks
Babkockdood

 
Member Since: Oct 25, 2009
Posts: 59
Babkockdood is on a distinguished road

Babkockdood is offline
Control-click. Error Handlers > Message and OK.
QUOTE Thanks

Post Reply New Thread Subscribe


« help with termianal | I cannot properly install gcc and gfortran »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
The Official "How To Transfer Your iPod or iTunes Library to Your New Mac" Thread TheCustomer99 iPod Hardware and Accessories 64 02-26-2013 03:39 PM
how to mass delete physical files from itunes mav5125 iOS and Apps 4 10-15-2009 10:24 AM
iTunes movies and TV shows on external music on internal Chimpur Music, Audio, and Podcasting 5 02-01-2009 02:29 PM
iTunes library on external HD only. Starting from scratch Doug b OS X - Apps and Games 5 09-12-2008 12:51 PM
iTunes applescript aid needed nozomimomi OS X - Apps and Games 0 06-06-2005 04:35 PM

All times are GMT -4. The time now is 08:29 AM.

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

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?