• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Dumb Finder scripting question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Dumb Finder scripting question
      • From: Laine Lee <email@hidden>
References: 
 >Re: Dumb Finder scripting question (From: Michelle Steiner <email@hidden>)
 >Re: Dumb Finder scripting question (From: Laine Lee <email@hidden>)

  • Prev by Date: Re: Dumb Finder scripting question
  • Next by Date: Re: Dumb Finder scripting question
  • Previous by thread: Re: Dumb Finder scripting question
  • Next by thread: Re: Dumb Finder scripting question
  • Index(es):
    • Date
    • Thread