Re: Convert to Aiff Folder Action
Re: Convert to Aiff Folder Action
- Subject: Re: Convert to Aiff Folder Action
- From: Brandon Hunt <email@hidden>
- Date: Mon, 25 Sep 2006 04:03:37 -0500
- Thread-topic: Convert to Aiff Folder Action
Title: Re: Convert to Aiff Folder Action
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 email@hidden