Compressor folder actions with hierarchal paths

Im not sure if my topic title makes sense but what I’m trying to do is create a folder action that will convert captured video files into an acceptable file using a droplet. This is my first major script so I’m running into a lot of roadblocks. The folder will have multiple subfolders with mov files because thats how they are copied from our cameras.

What I need this script to do is:

  • check if an output folder exists and if not, create one at the root of the folder
  • find all files in the folder that end in the “.mov” extension
  • send those files to my droplet and save the encoded videos in the output folder

This script is incomplete so I’m pretty sure it wont work but this is where I’m at right now (its my Frankenstein monster of googled scripts).

-- set the amount of time before dialogs auto-answer.
property dialog_timeout : 6000

-- choose the folder where all videos originate
set chooseFolder to choose folder

tell application "Finder"
	set out_folder to make new folder at chooseFolder with properties {name:"output"} without replacing
end tell

tell application "Finder"
get all files with extension "mov"
	tell application "Finder"
		open chooseFile using application file "" of folder "Desktop" of folder "supa" of folder "Users" of startup disk
	end tell
end try
end adding folder items to