I created this script as a part of an applescript studio application to convert quicktime movies easily to flash files (using ffmpeg). Works great when dropping files on the app, but now I want to take matters to a higher level and want to detect if there are files stored in the input folder (items_in_folder)
I do not want to use a folder action! This is a script which is part of an ass application and because of that I do not want to use a folder action.
The idea is when someone starts the app the first thing it does is check the items_in_folder. If there are files in it it has to convert them and move them
to the output folder.
This is the script
on open theseItems
-- read preferences from a stored text file
set the_path to ((path to startup disk as text) & "Applications:FlashTMF:settings:")
set the_file to (((the_path) as string) & "settings.txt") as file specification
set read_data to read the_file as text
-- set input/output folders
set items_in_folder to (paragraph 1 of read_data) -- this is the folder in which the quicktime movies are stored
set flash_out_folder to (paragraph 2 of read_data) -- in this file the encoded flash files are stored
set items_out_folder to (paragraph 3 of read_data) -- after encoding the quicktime movies have to be moved to this folder
repeat with thisItem in theseItems
-- strip quicktime extension from the movie name
set {name:thisName} to (info for thisItem without size)
set x to the number of characters of thisName
set the_new_name to characters 1 thru (x - 4) of thisName
-- encode to flash
do shell script "/opt/local/bin/ffmpeg -i " & the POSIX path of thisItem & " -acodec libmp3lame -ab 160 -f flv -s 1024x576 -ar 44100 -aspect 16:9 -pass 1 -b 2500 -r 25 -y " & flash_out_folder & the_new_name & ".flv"
-- move file from in to out folder
-- send message to user
end repeat
end open
I googles my *ss of and also read a ton of posts on macscripter but can’t find the answer.
Anyone in for some help ??
thanks!