Re: Dumb Finder scripting question
Re: Dumb Finder scripting question
- Subject: Re: Dumb Finder scripting question
- From: "Mark J. Reed" <email@hidden>
- Date: Fri, 14 Dec 2007 23:08:34 -0500
So here's my finished script, which converts all the AVI movies saved from my Flip Video camera into QuickTime movies. It worked fine:
set toConvert to {}
set docPath to path to documents folder as text
tell application "Finder"
set aviFiles to (get files of entire contents of folder (docPath & "My Flip Video Library") whose name extension is "avi")
repeat with aviFile in aviFiles
set movFileName to (text 1 through -5 of (name of aviFile as string)) & ".mov"
if not (exists file movFileName of container of aviFile) then
set end of toConvert to URL of aviFile
end if
end repeat
end tell
if (count of toConvert) > 0 then
tell application "QuickTime Player"
repeat with aviURL in toConvert
set doc to first item of (open location aviURL)
set pathName to (get path of doc) as text
set fileName to (get name of doc) as text
set movPath to (text 1 through -5 of pathName) & ".mov"
set movName to (text 1 through -5 of fileName) & ".mov"
save self contained doc in POSIX file movPath
close document movName
end repeat
end tell
end if
Some annoyances - e.g. after the "save self contained" call, the name of the document changes, invalidating the document reference, so "close doc" won't work. I have to use "document newname", which means I have to construct the new name without the full path as well as with it...
any suggestions for improvement?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden