Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Convert to Aiff Folder Action



OK Brandon,

I was on the wrong track.  This script will work, you may have to use it as a droplet though:

Peter

tell application "QuickTime Player"
activate


try
if not (exists movie 1) then error "No movies are open."


stop every movie


-- CHECK FOR THE CORRECT VERSION
set QT_version to (QuickTime version as string)
set player_version to (version as string)
if (QT_version is less than "6.0") or ¬
(player_version is less than "6.0") then
error "This script requires QuickTime 6.0 or greater." & ¬
return & return & ¬
"Current QuickTime Version: " & QT_version & return & ¬
"Current QuickTime Player Version: " & player_version
end if


-- CHECK FOR QUICKTIME PRO
if QuickTime Pro installed is false then
set the target_URL to "http://www.apple.com/quicktime/download/"
display dialog "This script requires QuickTime Pro." & return & return & ¬
"If this computer is currently connected to the Internet, " & ¬
"click the “Upgrade” button to visit the QuickTime Website at:" & ¬
return & return & target_URL buttons {"Upgrade", "Cancel"} default button 2
ignoring application responses
tell application "Finder"
open location target_URL
end tell
end ignoring
error number -128
end if


-- get the name of the movie
set the movie_name to the name of movie 1
-- check to see if the opened movie can be exported
if (can export movie 1 as AIFF) is true then
-- prompt the user for a name and location
set the new_file to ¬
choose file name with prompt "Enter a name and choose a location for the new file:" default name movie_name
-- export the movie as AIFF movie
export movie 1 to new_file as AIFF
-- close the movie
close movie 1
else
error "This movie cannot be exported as an AIFF file."
end if
on error error_message number error_number
if the error_number is not -128 then
beep
display dialog error_message buttons {"Cancel"} default button 1
end if
end try
end tell

On 25/09/2006, at 7:03 PM, Brandon Hunt wrote:

I worked on this with a few ideas but all it brought up was a quicktime can not open these files error message.


on
adding folder items to this_folder after receiving these_items
   set numExported to 0
    repeat with each_file in these_items
       set fileInfo to info for each_file
       -- check if it's an AIFF file
       if file type of fileInfo is not "AIFF" then
           -- build a new file name by chopping off the existing extension and appending 'aiff'
           set newFilename to characters 1 through (-1 - (length of name extension of fileInfo)) of name of fileInfo & "aiff" as text
           tell application "QuickTime Player"
                open each_file
               if (can export movie 1 as AIFF = true) then
                   export movie 1 to new_file as AIFF with replacing
               end if
               set numExported to numExported + 1
            end tell
       end if
   end repeat
   if numExported > 0 then
       display dialog numExported & ¬
            " items have been converted to AIFF and added to folder “" & this_folder & ¬
            "”." buttons {"OK"} default button 1
    end if
end
adding folder items to


On 9/25/06 3:07 AM, "Jay Louvion" <email@hidden> wrote:

On 25.9.2006 7:07, "Brandon Hunt" <email@hidden> spake thus:

> Ok I am A First Time Scripter so I am a little new
>
> I Work With Final Cut pro and the fileformat that it likes you audio files
> to be in is Aiff and for each project that I work on I drop the audio files
> into a forlder for that project. I usualy have to use Quicktime pro to
> convert these files to Aiff and then drag them into the folder. I noticed
> that Quicktime is scriptable and was wondering if you could make an apple
> script to convert Files that are not aiff into aiff and then put them in the
> folder.
>
> Thanks and sorry I am just starting out with scripting and would love to
> learn.
>


Well then welcome, you’re going to have a lot of fun. And by fun I of course mean the kind you get by trying things over and over again until they work.
This should do the trick ;) I’m using QT7, but it should work in earlier versions.

on adding folder items to this_folder after receiving these_items
   repeat with the_file in these_items
       set old_name to name of (info for the_file)
        set short_name to items 1 thru -4 of old_name as text --this line is a bit of magic to get a file name without an extension (providing there is an extension and it’s three character long...mmhh kinda dodgy, but does the trick most times)
       tell application "Finder" to set new_file to (container of the_file as text) & short_name & "_converted.aiff" as string
       tell application "QuickTime Player"
            open the_file
           if (can export movie 1 as AIFF = true) then
               export movie 1 to new_file as AIFF with replacing
           end if
           close movie 1
        end tell
   end repeat
end
adding folder items to


Cordialement,

j.

Jay Louvion
Studio Casagrande
3, rue Müller-Brun
1208 Geneva

T+4122 840 3272
F+4122 840 3271

skypeme:
jaylouvion

www.studiocasagrande.com


P Please consider the environment before printing this email.



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to peterba1@mac.com



Peter Baxter




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden

References: 
 >Re: Convert to Aiff Folder Action (From: Brandon Hunt <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.