How to parse a file name?

I’ve been looking around for a while and can’t really figure out how to do what I want to do. I’m new to applescript but pretty computer-literate in general and am trying to learn.

I’m trying to make a workflow that will add a selected file to iTunes as a TV Show with parameters determined by its file name in a regular expression.

For example, if I have a file Show 3x02 - Name.avi, then I want to convert it to iPod format (via quicktime), import it into iTunes as a TV Show, and set it to Series: Show, Season 3, Episode 2, Title Name.

I have it worked up to the parsing of the filename part. I can right click on an avi, convert it, and add it to itunes as a TV Show, but now I am stuck on how to parse the file name.

I found this http://automatoractions.com/files/sedregularexpression1.1.html posted here, but I’m not sure how to use it. I would have to set the iTunes name to a string, and then pass it to that Automator Action, but I don’t know what to type in the automator action nor do I know how to convert the iTunes input to plain text.

Any help you guys can give me is appreciated.

Mike

I’ve got a script that does pretty much what you’re looking for. I’m on my iPhone, so I can’t post the script right now. If you want to play around with it now. See my post on the macrumors.com apple tv forum. The post is titled rip-o-matic … I just posted it the other day.